Hi Pascal, wow, thank you for your response - that helped a lot! After some struggles, I got it to register one test, and to execute it. Great. But, if I add two tests, both get registered, but only one gets executed ... therefore twice though.
I hope someone can tell me what I am doing wrong here: I added this to CMakeLists.txt -------8<------------------8<------------ FILE(GLOB UnitTests_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "cppunit/*CUtest.cpp" ) ADD_EXECUTABLE(UnitTester cppunit/test_runner.cpp ${UnitTests_SRCS}) TARGET_LINK_LIBRARIES(UnitTester cppunit) FOREACH(test ${UnitTests_SRCS}) MESSAGE(" ###### adding test ${test}") GET_FILENAME_COMPONENT(TestName ${test} NAME_WE) ADD_TEST(${TestName} UnitTester ${TestName}) ENDFOREACH(test) -------8>------------------8>------------ cppunit/testrunner.cpp looks like this -------8<------------------8<------------ #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/ui/text/TestRunner.h> int main (int argc, char* argv[]) { CppUnit::TextUi::TestRunner runner; CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry(); runner.addTest( registry.makeTest() ); bool failed = runner.run("", false); return !failed; } -------8>------------------8>------------ And the two test suites I have look like this: -------8<--------cppunit/s1_CUtest.cpp----------8<------------ #include <cppunit/extensions/HelperMacros.h> class S1CUTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( S1CUTest ); CPPUNIT_TEST( test1 ); CPPUNIT_TEST_SUITE_END(); private: public: void setUp() { } void tearDown() { } void test1() { CPPUNIT_ASSERT ( 3 == 5 ); } }; CPPUNIT_TEST_SUITE_REGISTRATION( S1CUTest ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( S1CUTest, "S1CUTest" ); -------8>------------------8>------------ -------8<--------cppunit/s2_CUtest.cpp----------8<------------ #include <cppunit/extensions/HelperMacros.h> class S2CUTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( S2CUTest ); CPPUNIT_TEST( test2 ); CPPUNIT_TEST_SUITE_END(); private: public: void setUp() { } void tearDown() { } void test2() { CPPUNIT_ASSERT ( 3 == 3 ); } }; CPPUNIT_TEST_SUITE_REGISTRATION( S2CUTest ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( S2CUTest, "S2CUTest" ); -------8>------------------8>------------ after some struggles, cmake now returns -------8<------------------8<------------ ###### adding test cppunit/s2_CUtest.cpp ###### adding test cppunit/s1_CUtest.cpp -------8>------------------8>------------ but, then, when I run the tests, I get this (ctest -VV) -------8<------------------8<------------ 1/ 2 Testing s2_CUtest Test command: /[..]/test/UnitTester s2_CUtest !!!FAILURES!!! Test Results: Run: 2 Failures: 1 Errors: 0 1) test: S1CUTest::test1 (F) line: 21 /[..]/cppunit/s1_CUtest.cpp assertion failed - Expression: 3 == 5 ..F -- Process completed ***Failed 2/ 2 Testing s1_CUtest Test command: /[..]/test/UnitTester s1_CUtest !!!FAILURES!!! Test Results: Run: 2 Failures: 1 Errors: 0 1) test: S1CUTest::test1 (F) line: 21 /[..]/cppunit/s1_CUtest.cpp assertion failed - Expression: 3 == 5 ..F -- Process completed ***Failed [..] -------8>------------------8>------------ I bet I am doing something stupid here ... but why does it execute one test twice, instead of two once ... Any input very welcome, thanks, JAN _______________________________________________________________ SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192 _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake