Installation and Setup
There are two avenues to including xUnit++ in your project:
- Clone the project somewhere.
- Download and unpack the latest official release.
- When including the full source of xUnit++ within your project, it is recommended that you include it somewhere within your project's tree. This way you can keep your version of xUnit++ synchronized with your project.
hg clone ssh://email@example.com/moswald/xunit path_to/project_root/external/xUnit++
- Add the xUnit++ library to your build process.
- For Windows, the supported build system is a set of MSBuild/Visual Studio projects.
- For everything else, the build system is SCons. Currently, there is only minimal support in the
SConstructand related files for Windows, since MSBuild and Microsoft's C++ compiler are free (as in beer).
- Create a shared library project (.dll or .so) to store your tests. xUnit++ comes with a suite of tests for itself; you can use this as an example.
- Modify your test project's include path to include
- Modify your test project's link settings to include
- Optionally (but recommended), include the xUnit++.console project in your build, and modify your test project's build to include running your tests after every succesful build. xUnit++.console will return the number of failed tests, so you can use that return value to halt your build script.
- Download the latest release and unpackage it somewhere within your source tree, for example
- Create a shared object library project (.dll or .so) to store your tests. xUnit++ comes with a suite of tests for itself; you can use this as an example.
- Modify your test project's include path to include the path to
- Modify your test project's link setting to include
- Optionally (but recommended), modify your build process to include running your test project's output, failing the build if the runner returns anything other than 0. Your platform's test runner can be found in
Regardless of the path taken to add xUnit++ to your project, you can install the xUnit++ Visual Studio Test Adapter. This will automatically discover and run your tests for you using the built-in Text Execution Window.
What about OS X and Clang?
I would love to support Clang and by extension OS X, but right now Clang 3.1 and 3.2 appear to have bugs when compiling lambdas. I've filed a bug report, and when it is fixed I will do what I can to get Clang up and running as a supported compiler for xUnit++.
Until then gcc 4.7+ is the only supported compiler for non-Windows systems.