本文整理汇总了C++中cppunit::textui::TestRunner类的典型用法代码示例。如果您正苦于以下问题:C++ TestRunner类的具体用法?C++ TestRunner怎么用?C++ TestRunner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputFile
int
main( int argc, char* argv[] )
{
ProjetUnivers::Kernel::Parameters::load("physic.config") ;
ProjetUnivers::Kernel::Log::init() ;
// if command line contains "-selftest" then this is the post build check
// => the output must be in the compiler error format.
bool selfTest = (argc > 1) &&
(std::string("-selftest") == argv[1]);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
// Define the file that will store the XML output.
std::ofstream outputFile("tests_physic.xml");
CppUnit::MultiOutputter* outputter = new CppUnit::MultiOutputter() ;
outputter->add(new CppUnit::CompilerOutputter(&runner.result(),std::cerr)) ;
outputter->add(new ProjetUnivers::Kernel::XmlOutputter(&runner,outputFile)) ;
runner.setOutputter(outputter);
// Run the test.
bool wasSucessful = runner.run( "" );
ProjetUnivers::Kernel::Log::close() ;
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
示例2: main
int main() {
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
runner.run();
return 0;
}
示例3: main
int main(int argc, char *argv[])
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestSuite *suite = new CppUnit::TestSuite();
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test1", &Trapping_Rain_WaterTest::test1));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test2", &Trapping_Rain_WaterTest::test2));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test3", &Trapping_Rain_WaterTest::test3));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test4", &Trapping_Rain_WaterTest::test4));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test5", &Trapping_Rain_WaterTest::test5));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test6", &Trapping_Rain_WaterTest::test6));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test7", &Trapping_Rain_WaterTest::test7));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test8", &Trapping_Rain_WaterTest::test8));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test9", &Trapping_Rain_WaterTest::test9));
suite->addTest(new CppUnit::TestCaller<Trapping_Rain_WaterTest>(
"test10", &Trapping_Rain_WaterTest::test10));
runner.addTest(suite);
runner.run("", true);
return 0;
}
示例4: 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;
}
示例5:
int
main( int argc, char* argv[] )
{
ProjetUnivers::Kernel::Parameters::load("sound.config") ;
ProjetUnivers::Kernel::Log::init() ;
// if command line contains "-selftest" then this is the post build check
// => the output must be in the compiler error format.
bool selfTest = (argc > 1) &&
(std::string("-selftest") == argv[1]);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
if ( selfTest )
{ // Change the default outputter to a compiler error format outputter
// The test runner owns the new outputter.
runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter(
&runner.result(),
std::cerr ) );
}
// Run the test.
bool wasSucessful = runner.run( "" );
ProjetUnivers::Kernel::Log::close() ;
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
示例6: main
int main(int, char *[])
{
CppUnit::TextUi::TestRunner runner;
runner.addTest(DllModule_tests::suite());
return !runner.run();
}
示例7: main
int main(int argc, char* argv[])
{
InitModuleObjects();
// These are the internal unit tests covered by other modules and libraries
Array objects;
objects.append(*(new LoadedObject ("jhtree")));
objects.append(*(new LoadedObject ("roxiemem")));
objects.append(*(new LoadedObject ("thorhelper")));
queryStderrLogMsgHandler()->setMessageFields(MSGFIELD_time);
CppUnit::TextUi::TestRunner runner;
if (argc==1)
{
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
}
else
{
for (int name = 1; name < argc; name++)
{
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(argv[name]);
runner.addTest( registry.makeTest() );
}
}
bool wasSucessful = runner.run( "", false );
ExitModuleObjects();
releaseAtoms();
return wasSucessful;
}
示例8: main
int main( int argc, char ** argv ) {
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
ofstream out;
if ( argc == 2 ) {
out.open( argv[ 1 ] );
}
runner.setOutputter(
new CppUnit::XmlOutputter(
&runner.result(),
( out.is_open() ? out : std::cerr )
)
);
// Run the tests.
bool wasSucessful = runner.run();
if ( out.is_open() ) {
out.close();
}
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
示例9: main
int main( int /*argc*/, char** /*argv*/)
{
/// 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
// uncomment the following line if you need a compiler outputter.
runner.setOutputter(new CppUnit::CompilerOutputter( &runner.result(),
std::cout ) );
// Change the default outputter to a xml error format outputter
// uncomment the following line if you need a xml outputter.
//runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),
// std::cerr ) );
/// Run the tests.
// bool wasSuccessful = runner.run();
// If you want to avoid the CppUnit typical output change the line above
// by the following one:
bool wasSuccessful = runner.run("",false,true,false);
// Return error code 1 if the one of test failed.
// Uncomment the next line if you want to integrate CppUnit with Oval
if(!wasSuccessful) std::cerr <<"Error: CppUnit Failures"<<std::endl;
std::cout <<"[OVAL] Cppunit-result ="<<!wasSuccessful<<std::endl;
return wasSuccessful ? 0 : 1;
}
示例10: OnInit
bool wxExTestApp::OnInit()
{
SetAppName("wxex-test-gui-report");
if (!wxExApp::OnInit())
{
return false;
}
wxExFrameWithHistory *frame = new
wxExFrameWithHistory(NULL, wxID_ANY, wxTheApp->GetAppDisplayName());
frame->Show(true);
wxLog::SetActiveTarget(new wxLogStderr());
CppUnit::TextUi::TestRunner runner;
wxExTestSuite* suite = new wxExTestSuite;
runner.addTest(suite);
runner.run();
// Return false, so test ends here.
return false;
}
示例11: main
int main()
{
CppUnit::TextUi::TestRunner runner;
runner.addTest( ObjectPoolTest::suite() );
runner.run();
return 0;
}
示例12: main
int main(int argc, char* argv[])
{
std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
CPPUNIT_NS::TestResult controller;
CPPUNIT_NS::TestResultCollector result;
controller.addListener(&result);
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener(&progress);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
try
{
CPPUNIT_NS::stdCOut() << "Running " << testPath;
runner.run(controller, testPath);
CPPUNIT_NS::stdCOut() << "\n";
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();
}
catch( std::invalid_argument& e)
{
CPPUNIT_NS::stdCOut() << "\n" << "ERROR: " << e.what() << "\n";
}
return result.wasSuccessful() ? 0 : 1;
}
示例13: main
int main( int argc, char ** argv )
{
// figure out where our sources are and where we can write
srcdir = getenv( "srcdir" );
if( srcdir.isEmpty() ) srcdir = ".";
builddir = getenv( "top_builddir" );
if( builddir.isEmpty() ) builddir = ".";
if( lt_templates_initialize() == -1 ) {
fprintf( stderr, "Unable to initialize Lintouch Templates Library\n" );
return -1;
}
atexit( lt_templates_terminate );
QApplication a( argc, argv, false );
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry =
CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasThereError = runner.run( "", false );
// shell expects 0 if successfull
return !wasThereError;
}
示例14: main
int main( int argc, char **argv)
{
// Create the event manager and test controller
CppUnit::TestResult controller;
// Add a listener that colllects test result
CppUnit::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CppUnit::BriefTestProgressListener progress;
controller.addListener( &progress );
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
runner.run( controller, "" );
// Resultate im Compiler-Format ausgeben
CppUnit::CompilerOutputter compileroutputter( &result, std::cerr );
compileroutputter.write();
// Rueckmeldung, ob Tests erfolgreich waren
return ( result.wasSuccessful() ? 0 : -1 );
}
示例15: main
int main( int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
runner.addTest( MumukiTest::suite() );
runner.run();
return 0;
}