CXX Test How To
This is not a tutorial. If you do not know how to use g++ and/or makefiles, then please refer to the gcc and makefile tutorials as needed. Also, this document does not attempt to teach you how to use the cxx test API. Note that if you installed eclipse per the installation instructions, and are using Eclipse to compile and run cxx tests, then you do not need to follow these directions, you should already be able to use cxx testing. If, however, you wish to use command line tools such as g++ and make to manage your projects, this document is where you should get started.
Note that the files provided here will most likely work with Unix computers but expect a specific configuration on Windows computers. It is assumed that Unix users either already have perl installed on their system, or they have the competency to install it on their own. Also, if a user wishes to use a different c++ compiler, it is assumed that the user knows how to modify the included makefile to suit their needs.
- Download the CXX Test package
- Extract the files to any location you see fit. A good place on Windows is in your compiler's main directory, such as C:\Program Files\MinGW\CxxTest. A good place on a Unix system might be /usr/local/lib/ or in your home directory. On either system, keeping the folder in the directory where you do most of your development is O.K. too, as long as you remember where the folder is because there is a perl script inside that you will need to execute.
- Open the CxxTest folder after extracting. there is then another sub-folder called cxxtest. Inside are several header files your compiler needs to be aware of.
- Copy this folder into your compiler's include directory. On unix machines, you should put this folder into /usr/local/include. This is a universal include folder for all types of header and resource files for unix programming. Windows compilers are not so lucky. MinGw provides a folder called 'include' in an effort to mimic the global include feature found on unix machines. Copy the folder of header files into C:\Program Files\MinGW\include, or to the include directory of wherever you installed MinGW. Refer to documentation for other compilers to see where you should store the header files.
- Read the first few sections of the user's guide found in the docs folder of the archive you extracted in step 3.
- Here is makefile.cxxtest (be sure to save the file without the .cxxtest extension, or use the -f command with make) and MyTestSuite.h to get you started.
- The makefile code can be added to your own project makefile very easily. Then you can build your other sources as you please, and when it is time for testing, you type 'make runcxx' to actually run the test on the command line. Be sure that the test file you write is called 'MyTestSuite.h' or modify the makefile code accordingly.

