CppUnit et generation de rapport en format XML
Salut!
Je suis en train de developper des tests unitaires avec cppUnit. Pour celà je veux generer les rapport en format XML (et si possible ecrire mes propres commentaire). Je ne sais pas comment faire!
Voici en fait un main programme d'un test que j'ai fait jusqu'ici. Comment dois-je faire en sorte que je recoive un rapport en fichier XML? Quelqu'in a-t-il dejà été confronté à celà? J'ai besoin de votre aide.
Merci d'avance
Merlin
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| #include <CommonIncludes/BeginPragma.h>
// Für den TG-Viewer
//#define _TGVIEWER
#ifdef _TGVIEWER
#pragma comment(lib,"..\\..\\..\\..\\..\\..\\..\\Install\\exe_debug\\_HiPlugin_TGViewer")
#include <TopGeomProjects\TGViewer\_HiPlugin_TGViewer\TGViewerWindow.h>
#endif
// Includes
#include <DebugUtilities/LogingGuard.h>
#include <DebugUtilities/LogManager.h>
#include <DebugUtilities/CrtWarningHooks.h>
// External Includes
#include <CommonIncludes/BeginExternal.h>
#include <cppunit/include/cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/include/cppunit/CompilerOutputter.h>
#include <cppunit/include/cppunit/ui/text/TestRunner.h>
#include <omp.h>
#include <CommonIncludes/EndExternal.h>
#pragma region Contents
int __cdecl main()
{
#ifdef _TGVIEWER
// Für den TG-Viewer
add_plot_output_device(std::auto_ptr<utl::PlotOutputDevice>(new TGViewer::TGViewerWindow()));
#endif
_CrtSetReportHook(&utl::Crt2WarnOrError);
_set_invalid_parameter_handler(&utl::CrtInvalidParameterHandler2Error);
utl::enable_loging();
utl::LogingGuard tester("FeatureDataBaseTest", "ErrorCounter");
int errorCountStart = tester.get_error_counter();
const int numThreads = 1;
bool success[numThreads];
#pragma omp parallel num_threads(numThreads)
{
// Get the top level suite from the registry
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
// Adds the test to the list of test to run
CppUnit::TextUi::TestRunner runner;
runner.addTest(suite);
// Change the default outputter to a compiler error format outputter
runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(),std::cerr));
// Run the tests.
success[omp_get_thread_num()] = runner.run();
}
// Return error code 1 if one of the test failed.
for (int i = 0; i < numThreads; ++i)
{
if (!success[i])
return 1;
}
int errorCountEnd = tester.get_error_counter();
tester.positively_finished();
if (errorCountEnd != errorCountStart)
{
std::cout << __FILE__ << "(" << __LINE__ << ") : FEHLER (" << errorCountEnd - errorCountStart << " ERROR_DIRECTs)" << std::endl;
return 1;
}
return 0;
}
#pragma endregion
#include <CommonIncludes/EndPragma.h> |