1 Introduction
2 ------------
4 CxxTest is a JUnit/CppUnit/xUnit-like framework for C++.
6 Its advantages over existing alternatives are that it:
7 - Doesn't require RTTI
8 - Doesn't require member template functions
9 - Doesn't require exception handling
10 - Doesn't require any external libraries (including memory management,
11 file/console I/O, graphics libraries)
13 This makes it extremely portable and usable.
15 CxxTest is available under the GNU Lesser General Public Licence (LGPL).
16 See http://www.gnu.org/copyleft/lesser.html for the license.
18 Simple user's guide
19 -------------------
21 1. Create a test suite header file:
23 MyTest.h:
24 #include <cxxtest/TestSuite.h>
26 class MyTestSuite : public CxxTest::TestSuite
27 {
28 public:
29 void testAddition( void )
30 {
31 TS_ASSERT( 1 + 1 > 1 );
32 TS_ASSERT_EQUALS( 1 + 1, 2 );
33 }
34 };
37 2. Generate the tests file:
39 # cxxtestgen.pl -o tests.cpp MyTestSuite.h
42 3. Create a main function that runs the tests
44 main.cpp:
45 #include <cxxtest/ErrorPrinter.h>
47 int main( void )
48 {
49 CxxText::ErrorPrinter::runAllTests();
50 return 0;
51 }
54 4. Compile and run!
56 # g++ -o main main.cpp tests.cpp
57 # ./main
58 Running 1 test(s).OK!
61 Advanced User's Guide
62 ---------------------
63 See docs/guide.html.