I am working with CppUnit for two weeks now and I am getting the whole picture step by step.
I was able to create a sample project with the textbased testrunner. Then I wanted to create another project, which uses the MFC-based testrunner.
With the help of the HostApp example application I've gotten a simple mfc-application which can be started. I see the test-window but in the drop-down box are no tests.
So I have copy the test-class (ExampleTestCase) from the HostApp-Project, but there is still no test-case in the drop-down-box.
I started the HostApp-Project and it is the same. No test-case to start. What do I have to do, to get the test-cases in the MFC-testrunner.
As far as I understand the whole thing, the testrunner searches in the TestFactoryRegistry and creates a new testsuite. Are the tests not yet registered? I thought they should be, with this code in the ExampleTestCase.h:
And as I mentioned above, it is the same thing with the example application HostApp. It starts but I the combo-box with the tests to start is empty. So what could be the problem? The settings in the sample project should be ok, shouldn't they?
Do you have a running application which you could possibly mail me?
Ole
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now I made an interesting new discovering.
Everything I wrote about was tested with the version 1.9.10.
Now I added the link of the 1.8.0 version to the lib-directory and started the HostApp of this version. Everything runs correctly. The curios thing is, that after this, also the HostApp of the version 1.9.10. runs correctly.
I even get the same image, with the same tests have being run. It looks like I started the HostApp of 1.8.0, but it was 1.9.10!
Nevertheless, my own application still doesn't run. The browse-button remains grey and it cannot be pushed to select a test.
Wondering,
Ole
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everybody!
I am working with CppUnit for two weeks now and I am getting the whole picture step by step.
I was able to create a sample project with the textbased testrunner. Then I wanted to create another project, which uses the MFC-based testrunner.
With the help of the HostApp example application I've gotten a simple mfc-application which can be started. I see the test-window but in the drop-down box are no tests.
So I have copy the test-class (ExampleTestCase) from the HostApp-Project, but there is still no test-case in the drop-down-box.
I started the HostApp-Project and it is the same. No test-case to start. What do I have to do, to get the test-cases in the MFC-testrunner.
As far as I understand the whole thing, the testrunner searches in the TestFactoryRegistry and creates a new testsuite. Are the tests not yet registered? I thought they should be, with this code in the ExampleTestCase.h:
CPPUNIT_TEST_SUITE( ExampleTestCase );
CPPUNIT_TEST( example );
CPPUNIT_TEST( anotherExample );
CPPUNIT_TEST( testAdd );
CPPUNIT_TEST( testDivideByZero );
CPPUNIT_TEST( testEquals );
CPPUNIT_TEST_SUITE_END();
Or am I totally wrong?
Thanks in advance for any help!
Ole
You also need in the ExampleTestCase.cpp:
CPPUNIT_TEST_SUITE_REGISTRATION(ExampleTestCase);
Wolfgang
Oh, I forgot to mention that, but I had this registration thing before.
Any other ideas?
Thanks for your answer anyway!
Ole
Hm - you also need run-time-type-info (RTTI) enabled. But as I remember, the application crashes without. Still, it might be the problem ...
Wolfgang
But it isn't... RTTI is enabled.
And as I mentioned above, it is the same thing with the example application HostApp. It starts but I the combo-box with the tests to start is empty. So what could be the problem? The settings in the sample project should be ok, shouldn't they?
Do you have a running application which you could possibly mail me?
Ole
Now I made an interesting new discovering.
Everything I wrote about was tested with the version 1.9.10.
Now I added the link of the 1.8.0 version to the lib-directory and started the HostApp of this version. Everything runs correctly. The curios thing is, that after this, also the HostApp of the version 1.9.10. runs correctly.
I even get the same image, with the same tests have being run. It looks like I started the HostApp of 1.8.0, but it was 1.9.10!
Nevertheless, my own application still doesn't run. The browse-button remains grey and it cannot be pushed to select a test.
Wondering,
Ole