Contents
MFC TestRunner
Here is a screenshot of the MFC based TestRunner:
The following documentation pages have more information:
http://cppunit.sourceforge.net/doc/lastest/_mfc_test_runner_8h-source.html
http://cppunit.sourceforge.net/doc/lastest/class_mfc_test_runner.html
Microsoft Visual C++ 6.0
The following page contains a good overview of the step required to build an MFC based test project: http://www.codeproject.com/library/Using_CPPUnit.asp -- BaptisteLepilleur
In case that page goes down, here are the basic steps (please flesh them out if you have MSVC 6.0!):
- Follow the INSTALL-WIN32.txt instructions to get the libraries built
- Create a new MFC Application
- Dialog based (since that appears to be the most minimal)
- Use MFC in a shared DLL
- Disable (almost) everything else, since it will probably be thrown out.
- Try compiling and running, to make sure there are no issues.
- Add cppunit.lib and testrunner.lib (or the debug versions, cppunitd.lib and testrunnerd.lib) to your Linker dependencies. These are in the /lib folder.
Modify the CWinApp-derived class's InitInstance to call the MfcTestRunner, such as:
1 2 #include <cppunit/ui/mfc/MfcTestRunner.h> 3 #include <cppunit/extensions/TestFactoryRegistry.h> 4 5 BOOL CMyMFCApp::InitInstance() 6 { 7 CWinApp::InitInstance(); 8 9 CppUnit::MfcTestRunner runner; 10 runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() ); 11 runner.run(); 12 13 return FALSE; 14 }
Microsoft Visual C++ 7.0
In 1.10.2, the test runner works, but the DSPlugIn doesn't. This means that you get the pretty graphical test run, test selection, etc., but clicking on the error will not jump to the code. It appears that the test runner runs the whole suite twice as well, but that may just be my code.
However, 1.11.4 (as of March 2005, the CVS version) has a version that works, without a plugin, in MSVC 7.0:
http://cvs.sourceforge.net/viewcvs.py/cppunit/cppunit/NEWS?rev=HEAD
Microsoft Visual C++ 8.0
To get this working, I had to set TestRunner as startup project, do "build solution", then set back to TestPlugInRunner as startup project and do "build solution", then I got it working.
Also, don't forget to use the correct version of TestRunner*.lib (TestRunnerD.lib for debug, TestRunnerUD.lib for Unicode, i believe)
Dead Instructions
My notes while playing with CppUnit in Visual Studio .NET 2003 can be found at: http://www.componentsnotebook.com/agilehacker/blog.html#CppUnit
> Thank you for that blog entry! It was very helpful to me after 5+ hours reading around online and in the CppUnit documentation. Using your instructions (and what I'd learned about CppUnit in general) I was able to integrate the CppUnitTestApp into my solution (in VS.NET 2003). - Darren Torpey; July 6th, 2004
The link to the notes seems to be dead. Would you please check this? best regards Stefan Rauch, Feb. 28th, 2005
It's dead for me too, nothing in the Google cache, and the Wayback machine says the site died over a year ago. I'll try to get it running on my box, and see if I can create some instructions. If you have some in your back pocket, please post them here -- JohnWhitlock 2005-02-28 19:28:13
Seems to be back up again. I've archived it in case it dies again. -- MikeHigginbottom 2005-05-14 23:26:00
My hosting provider was hacked, after 2 weeks they still didn't have their DNS fixed so I switched to new provider. I intend to keep that link active, & hopefully update the information. -- Bill Burris 2005-05-25 11:11:00