本文整理汇总了C++中cppunit_ns::TestResultCollector类的典型用法代码示例。如果您正苦于以下问题:C++ TestResultCollector类的具体用法?C++ TestResultCollector怎么用?C++ TestResultCollector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestResultCollector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* argv[])
{
// informs test-listener about test-results
CPPUNIT_NS::TestResult testResult;
// register listener for collecting the test-results
CPPUNIT_NS::TestResultCollector collectedResults;
testResult.addListener( &collectedResults);
// register listener for per-test progress output
CPPUNIT_NS::BriefTestProgressListener progress;
testResult.addListener( &progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS::TestRunner testRunner;
testRunner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
testRunner.run(testResult);
// important stuff happens next
std::ofstream xmlFileOut("reports/testResults.xml");
CPPUNIT_NS::XmlOutputter xmlOut( &collectedResults, xmlFileOut);
xmlOut.write();
// return 0 if tests were successful
return collectedResults.wasSuccessful() ? 0 : 1;
}
示例2: outputter
int
main( int argc, char* argv[] )
{
util::CLoggerMgr::Config(util::Log4Cxx);
// Create the event manager and test controller
CPPUNIT_NS::TextTestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
//CPPUNIT_NS::TextTestRunner runner;
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller);
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
util::CLoggerMgr::CleanLoggers();
system("pause");
return result.wasSuccessful() ? 0 : 1;
}
示例3: main
int main()
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
// output
CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr);
outputter.write();
// return status code
return result.wasSuccessful() ? 0 : 1;
}
示例4: main
int main(int argc, char* argv[])
{
// informs test-listener about testresults
CPPUNIT_NS::TestResult testresult;
// register listener for collecting the test-results
CPPUNIT_NS::TestResultCollector collectedresults;
testresult.addListener (&collectedresults);
// register listener for per-test progress output
CPPUNIT_NS::BriefTestProgressListener progress;
testresult.addListener (&progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS::TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest ());
testrunner.run(testresult);
// output results in compiler-format
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
compileroutputter.write ();
// Output XML for Jenkins CPPunit plugin
ofstream xmlFileOut("cppTestBasicMathResults.xml");
XmlOutputter xmlOut(&collectedresults, xmlFileOut);
xmlOut.write();
// return 0 if tests were successful
return collectedresults.wasSuccessful() ? 0 : 1;
}
示例5: main
int main(int argc, char* argv[])
{
// Retrieve test path from command line first argument. Default to "" which resolve
// to the top level suite.
std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that collects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
// Uncomment this for XML output
std::ofstream file("cppunit-report.xml");
CPPUNIT_NS::XmlOutputter xml(&result, file);
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
示例6: main
int main(int argc, char* argv[])
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry("All Tests").makeTest() );
runner.run( controller );
// Print test in a text format.
CPPUNIT_NS::TextOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
// This for XML output
std::ofstream file( "TestResult.xml" );
CPPUNIT_NS::XmlOutputter xml( &result, file );
xml.setStyleSheet( "report.xsl" );
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
示例7: main
int main(int ac,char **av)
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
CppUnit::TextUi::TestRunner runner;
// Add the top runner.to the test runner
runner.addTest( CTimezone_TS1::suite() );
runner.run( controller );
// Print test in a compiler compatible format.
std::ofstream file("ctimezone.xml");
CPPUNIT_NS::XmlOutputter xml( &result, file );
xml.setStyleSheet( "report.xsl" );
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
示例8: main
int main(int ac,char **av)
{
enable_logging = 1;
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
CppUnit::TextUi::TestRunner runner;
// Add the top runner.to the test runner
runner.addTest( CCalendarProcs_TS1::suite() );
// runner.addTest(new CppUnit::TestCaller<ValidCTodoConstructorTestCase>(
// "test_validCTodoConstructor",
// &ValidCTodoConstructorTestCase::test_validCTodoConstructor));
runner.run( controller );
// Print test in a compiler compatible format.
std::ofstream file("dbprocs.xml");
CPPUNIT_NS::XmlOutputter xml( &result, file );
xml.setStyleSheet( "report.xsl" );
xml.write();
file.close();
return result.wasSuccessful() ? 0 : 1;
}
示例9: main
int main(int argc, char**const argv)
{
#ifndef _WIN32
setenv("SOFTHSM2_CONF", "./softhsm2.conf", 1);
#else
setenv("SOFTHSM2_CONF", ".\\softhsm2.conf", 1);
#endif
CPPUNIT_NS::TestFactoryRegistry ®istry( CPPUNIT_NS::TestFactoryRegistry::getRegistry() );
CPPUNIT_NS::TextTestRunner runner;
runner.addTest(registry.makeTest());
if ( argc<2 ) {
return runner.run() ? 0 : 1;
}
if ( std::string("direct").find(*(argv+1))==std::string::npos ) {
return runner.run(*(argv+1)) ? 0 : 1;
}
runner.addTest(registry.makeTest());
CPPUNIT_NS::TestResult controller;
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
MyListener progress;
controller.addListener( &progress );
runner.run(controller);
return result.wasSuccessful() ? 0 : 1;
}
示例10: main
int main(void)
{
// informs test-listener about testresults
CPPUNIT_NS::TestResult testresult;
// register listener for collecting the test-results
CPPUNIT_NS::TestResultCollector collectedresults;
testresult.addListener(&collectedresults);
// register listener for per-test progress output
CPPUNIT_NS::BriefTestProgressListener progress;
testresult.addListener(&progress);
// insert test-suite at test-runner by registry
CPPUNIT_NS::TestRunner testrunner;
testrunner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
testrunner.run(testresult);
// output results in compiler-format
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
compileroutputter.write();
// return 0 if tests were successful
return collectedresults.wasSuccessful() ? 0 : 1;
}
示例11: main
int main(int argc, char *argv[])
{
Logging::Logger::setGlobalLogger(new Logging::GenericLogger("testLogger"));
// initialize the AlarmSystemInterfaceFactory
ACSAlarmSystemInterfaceFactory::init(NULL);
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
std::cout.flush();
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.write();
// close the AlarmSystemInterfaceFactory
ACSAlarmSystemInterfaceFactory::done();
return result.wasSuccessful() ? 0 : 1;
}
示例12: outputter
int
main( int, char ** )
{
// create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// add a listner that collects test results
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// add a listener that prints dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
//CPPUNIT_NS::TextTestProgressListener textprog;
//controller.addListener( &textprog );
// add the top suite to the test runner.
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// output results in a compiler compatible format
CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
//CPPUNIT_NS::TextOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
//CPPUNIT_NS::XmlOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
示例13: outputter
int
main( int argc, char* argv[] )
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
//CPPUNIT_NS::BriefTestProgressListener progress;
//controller.addListener( &progress );
//controller.push
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
示例14: main
int main( int argc, char **argv )
{
argc = 0;
std::cout << "Running " << argv[argc] << std::endl;
// イベントマネージャを作成する
CPPUNIT_NS::TestResult controller;
// テスト結果を収集するオブジェクトを作成する
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// テスト実行時に進行状況を表示するオブジェクトを作成する
//CPPUNIT_NS::BriefTestProgressListener progress;
//controller.addListener( &progress );
// テストランナーにテストを設定する
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry( ).makeTest( ) );
runner.run( controller );
// テスト結果を出力する
CPPUNIT_NS::TextOutputter outputter( &result, std::cout );
outputter.write( );
// テストに成功した場合に 0 を返し,失敗したら 1 を返す
return( result.wasSuccessful( ) ? 0 : 1 );
}
示例15: main
int main(int argc, char** argv)
{
try
{
CPPUNIT_NS::TestResult controller;
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
runner.run(controller);
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
return result.wasSuccessful() ? 0 : -1;
}
catch(const std::exception& exc)
{
std::cout << exc.what() << std::endl;
}
catch(...)
{
std::cout << "Unknown exception." << std::endl;
}
return -1;
}