Hello,
I use wxTestRunner application to load (with PlugInManager a test dll.
in my code i have :
CppUnit::PlugInManager _plugInManager;
CppUnit::TestSuite *_suite;
i make :
_plugInManager.load(dll_name);
_suite->addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
After that i create a tree (on wxWidget window) who represente the TestSuite, it will be by this function :
void wxTestRunnerTree::AddTestItems(wxTreeItemId &parentId, CppUnit::Test *suite)
{
int nbelts = suite->getChildTestCount();
int childIndex = 0;
wxString str;
for ( ; childIndex < nbelts; ++childIndex ) {
CppUnit::Test *test = suite->getChildTestAt( childIndex );
str = test->getName();
int image, imageSel;
if (test->getChildTestCount() == 0)
image = TreeCtrlIcon_File;
else
image = TreeCtrlIcon_Folder;
imageSel = image + 1;
wxTreeItemId id = AppendItem(parentId, str, image, imageSel,
new MyTreeItemData(str, test));
// and now we also set the expanded one (only for the folders)
if ( test->getChildTestCount() ) {
SetItemImage(id, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
AddTestItems(id, test);
}
}
}
I don't have problem with Borland 5.0 and the tree is build.
But in Visual Studio 2005, i have an execution error on test->getName(). It return the good value (apparently the TestSuite is build correctly) but crash on a std::string destructor just after that.
Thanks for any fast return.
I just use wxWidget 2.8.9 and cppUnit 1.12.1 on Visual Studio 2005
I think i have the response....
Apparently.. if i change :
CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "Communication Test" );
suiteOfTests->addTest( new CppUnit::TestCaller<IntMessComm>("Communication Test 1", &IntMessS2000PM2::tu_startcomOK));
by :
CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite( "Comm Test" );
suiteOfTests->addTest( new CppUnit::TestCaller<IntMessComm>("Comm Test 1", &IntMessS2000PM2::tu_startcomOK));
it's work !!!
all names mustn't exceed 15 caracters !!!
It's quick test... i try with pluginmanger now....
It's also OK with plugInManager...but the unload method (of plugInManager) crash.
Are you sure that you use the same run-time across all your libraries? The bug you describe sound a like lot incompatible heap:
- memory allocated in the plug-in is freed with another incompatible allocator outside the plug-in leading to a crash.
=> the 15 characters limit is due to an std::string optimization that avoid allocating memory if the string is small enough....