Пример #1
0
int main(int argc, char** argv)
{
	(void)argc;
	(void)argv;

#	ifdef USING_XML_OUTPUT
		CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
		CPPUNIT_NS::TextTestRunner runner;
		std::ofstream stream("tests.xml");
		CPPUNIT_NS::XmlOutputter* xml = new CPPUNIT_NS::XmlOutputter(&runner.result(),stream);
		xml->setStyleSheet("report.xsl");
		runner.setOutputter(xml);
		runner.addTest( suite );
		//return runner.run() ? 0 : 1;
		bool result = runner.run();
		//as they may fail lets not brake a build yet just report the error
		//return 0;
		return !result;
#	else
		CppUnit::TextUi::TestRunner runner;
		CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
		runner.addTest( registry.makeTest() );
		runner.run( "", false );
		//as they may fail lets not brake a build yet just report the error
		//return 0;
		return !runner.run( "", false );
#	endif


}
Пример #2
0
int main(int argc, char* argv[])
{
    std::ofstream xmlout("DasherTest.xml");
    CPPUNIT_NS::TextTestRunner runner;
    CPPUNIT_NS::XmlOutputter *outputter = new CPPUNIT_NS::XmlOutputter(&runner.result(), xmlout);

    runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
    runner.run( "", false );
    outputter->write();

    utils::printMood(runner.result().wasSuccessful());

    return runner.result().wasSuccessful() ? 0 : 1;
}
Пример #3
0
int
main(int argc, char **argv) {
#if ENABLE_LOGGING == 1
    mqscommon::LoggingConfigurator::configure();
#endif
    
  CPPUNIT_NS::TestResult           testresult;
  CPPUNIT_NS::TestResultCollector  collectedresults;
  testresult.addListener (&collectedresults);

#if 0
  CPPUNIT_NS::TestRunner runner;
  CPPUNIT_NS::TestFactoryRegistry &registry = CPPUNIT_NS::TestFactoryRegistry::getRegistry();
  runner.addTest( registry.makeTest() );

  runner.run (testresult);
  std::ofstream outStream("out.xml");
  CPPUNIT_NS::XmlOutputter xmloutputter (&collectedresults, outStream);
  //CPPUNIT_NS::XmlOutputter xmloutputter (&collectedresults, std::cout);
  xmloutputter.write ();
  bool wasSuccessful = collectedresults.wasSuccessful () ;
#else
  CPPUNIT_NS::TextUi::TestRunner runner;
  CPPUNIT_NS::TestFactoryRegistry &registry = CPPUNIT_NS::TestFactoryRegistry::getRegistry();
  runner.addTest( registry.makeTest() );

    CPPUNIT_NS::CompilerOutputter *outputter =
        new CPPUNIT_NS::CompilerOutputter(&runner.result(), std::cout);
    outputter->setLocationFormat("%p(%l) : ");
    //outputter->setWrapColumn(19);
    outputter->setNoWrap();
    runner.setOutputter(outputter);
    bool wasSuccessful = runner.run("",
                                    false, // doWait
                                    true,  // doPrintResult
                                    true   // doPrintProgress
                                    );
#endif
    return !wasSuccessful;  
}