I am sorry for the primitive question but I want to ask how to set up a very primitive test suite. I am able to make a test suite based on HostApp but I can't believe this is the easiest way.
I would expect that I am able to create a test suite let's say as a DLL that I just load into some external program and it will run the tests for me.
I really don't want to have all of the code of HostApp with every test suite that I write.
Any comment is welcome. Thank you, Jan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Visual Studio I just declare a dialog based MFC-application. Then I remove the resources, dialogs, stdafx and related stuff and boil the main cpp-file down to (see below). Thus I'm left with only one file from the wizard generated framework . Then ofcourse you also need these libs for linking:
cppunit(d).lib testrunner(d).lib
hi,
I am sorry for the primitive question but I want to ask how to set up a very primitive test suite. I am able to make a test suite based on HostApp but I can't believe this is the easiest way.
I would expect that I am able to create a test suite let's say as a DLL that I just load into some external program and it will run the tests for me.
I really don't want to have all of the code of HostApp with every test suite that I write.
Any comment is welcome. Thank you, Jan
In Visual Studio I just declare a dialog based MFC-application. Then I remove the resources, dialogs, stdafx and related stuff and boil the main cpp-file down to (see below). Thus I'm left with only one file from the wizard generated framework . Then ofcourse you also need these libs for linking:
cppunit(d).lib testrunner(d).lib
hope this helps,
Wolfgang
#include "afxwin.h"
#include <msvc6/testrunner/TestRunner.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
class CUnitsApp : public CWinApp
{
public:
CUnitsApp() {}
//{{AFX_VIRTUAL(CUnitsApp)
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
};
CUnitsApp theApp;
static void RunTestRunner()
{
TestRunner runner;
runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
runner.run();
}
BOOL CUnitsApp::InitInstance()
{
RunTestRunner();
return FALSE;
}
thaks for your example. it works.
but i detect some memory leaks on it.
is there anyone who solves this problem? :)