• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cppunit::TextTestRunner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cppunit::TextTestRunner的典型用法代码示例。如果您正苦于以下问题:C++ TextTestRunner类的具体用法?C++ TextTestRunner怎么用?C++ TextTestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TextTestRunner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main ()
{
        CppUnit::TextTestRunner runner;
        runner.addTest(CStringTest::suite());
        runner.run();
        return 0;
}
开发者ID:martsbradley,项目名称:sumtree,代码行数:7,代码来源:StringTest.cpp


示例2: main

int main(int argc, char *argv[])
{
    CppUnit::TextTestRunner runner;
    runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());

    return !runner.run();
}
开发者ID:gitpan,项目名称:Term-Caca,代码行数:7,代码来源:caca-test.cpp


示例3: main

int main(int argc, char *argv[])
{
	Logging::Logger::setGlobalLogger(new Logging::GenericLogger("PropertyTestLogger"));

	CppUnit::TextTestRunner runner;
	runner.addTest( PropertyTestCase::suite() );
	runner.run("",false,true,false);
}
开发者ID:ACS-Community,项目名称:ACS,代码行数:8,代码来源:PropertyTest.cpp


示例4: main

//CPPUNIT_TEST_SUITE_REGISTRATION(mystringTest);
int main()
{
    CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    CppUnit::TextTestRunner runner;
    runner.addTest(test);
    runner.run();
    return 0;

}
开发者ID:EverydayQA,项目名称:prima,代码行数:10,代码来源:TestMain.cpp


示例5: main

int main(int argc, char* argv[]) {
  ofstream outputFile("./summary.xml");

  CppUnit::TextTestRunner runner;
  CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter(&runner.result(), outputFile, std::string("UTF-8"));
  runner.setOutputter(outputter);

  CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
  runner.addTest(registry.makeTest());
  bool result = runner.run("", false);
  return result ? 0 : 1;
}
开发者ID:foobarhe,项目名称:cpp-code,代码行数:12,代码来源:BaseTest.cpp


示例6: main

int main()
{
    CppUnit::TextTestRunner runner;
    CppUnit::Test* tp =
        CppUnit::TestFactoryRegistry::getRegistry().makeTest();

    runner.addTest(tp);

    if (runner.run()) {
        return 0;
    } else {
        return 1;
    }
}
开发者ID:sdavtaker,项目名称:metaserver-ng,代码行数:14,代码来源:MetaServerHandlerTCP_unittest.cpp


示例7: main

/* 
// ===  FUNCTION  ======================================================================
//         Name:  main
//  Description:  test driver
// =====================================================================================
*/
int main(int argc, char *argv[])
{
	/* 这部分代码一般是固定的,测试用例的多少是由CPPUNIT_TEST_SUITE_REGISTRATION宏决定的 */
	/* 通过执行代码,可以发现base_test的3个测试用例被测试了两遍,这也就是为什么当我们打算使用derived_test模型进行测试的时候,就不应该再注册base_test模型的原因 */
	CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
	CppUnit::TextTestRunner runner;
	runner.addTest(test);
	runner.run();

	/* log4cpp用法实例 */
	log4cpp_demo();

	return EXIT_SUCCESS;
}				// ----------  end of function main  ----------
开发者ID:dokey4444,项目名称:busybox,代码行数:20,代码来源:test_driver.cpp


示例8: main

int main(int /*argc*/, char** /*argv*/)
{
	CppUnit::Test *suite =
		CppUnit::TestFactoryRegistry::getRegistry().makeTest();

	CppUnit::TextTestRunner runner;
	runner.addTest( suite );

	runner.setOutputter(
		new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) );

	bool wasSucessful = runner.run();

	return wasSucessful ? 0 : 1;
}
开发者ID:rayfill,项目名称:risa_gl,代码行数:15,代码来源:test_main.cpp


示例9: run

void OsiTransportTest::run()
{
    // Do processing here

	CppUnit::TextTestRunner runner;
	runner.addTest(test1);
	runner.addTest(test2);
	runner.addTest(test3);

	runner.run();

	std::ofstream outFile("testResult.xml");
	CppUnit::XmlOutputter outputer(&runner.result(), outFile);
	outputer.write();

	emit finished();
}
开发者ID:Saotomych,项目名称:ositransport-test,代码行数:17,代码来源:ositransport-test.cpp


示例10: main

int main(int argc, char **argv)
{
  MooseInit init(argc, argv);

  registerApp(MissekatApp);

  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

  CppUnit::TextTestRunner runner;
  runner.addTest(suite);
  std::ofstream out;

  // If you run with --xml, output will be sent to an xml file instead of the screen
  if (argc == 2 && std::string(argv[1]) == std::string("--xml"))
  {
    runner.setOutputter ( new CppUnit::XmlOutputter( &runner.result(), out ) );
    out.open("test_results.xml");
  }

  else
  {
    // Note: upon calling setOutputter, any previous outputter is
    // destroyed. The TextTestRunner assumes ownership of the outputter, so you
    // don't have to worry about deleting it.
    runner.setOutputter ( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) );
  }

  bool wasSucessful = runner.run(/*testPath=*/"",
                                 /*doWait=*/false,
                                 /*doPrintResult=*/true,
                                 /*doPrintProgress=*/false);

  return wasSucessful ? 0 : 1;
}
开发者ID:mdj,项目名称:missekat,代码行数:34,代码来源:main.C


示例11: 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::TextTestRunner 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.
  bool wasSucessful = runner.run();

  // Return error code 1 if the one of test failed.
  return wasSucessful ? 0 : 1;
}
开发者ID:01d55,项目名称:UnitTestris,代码行数:18,代码来源:FieldCheck.cpp


示例12: main

int main()
{
    CppUnit::TextTestRunner runner;
    CppUnit::Test* tp =
            CppUnit::TestFactoryRegistry::getRegistry().makeTest();

    /**
     * How can i either add the testsuite or whatever to produce better visual results.
     */
    runner.addTest(tp);

    //runner.run("",false,true,true);
    if ( runner.run() ) {
        return 0;
    } else {
        return 1;
    }
}
开发者ID:sdavtaker,项目名称:metaserver-ng,代码行数:18,代码来源:DataObject_unittest.cpp


示例13: main

int main()
{
	// Get the top level suite from the test registry
	CppUnit::Test* suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

	// Add the test to the list of tests to run
	CppUnit::TextTestRunner runner;
	runner.addTest(suite);

	// Send the output to cerr when the compiler runs
	runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr));

	// Actually run the thing.
	bool successful = runner.run();

	// Return result
	return (successful ? 0 : 1);
}
开发者ID:a-price,项目名称:rubble,代码行数:18,代码来源:test_units.cpp


示例14: main

/**
 * Runs the unit test suites */
int main(int argc, char** argv)
{
  try
    {
      using CppUnit::Test;

      Test* test = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
      CppUnit::TextTestRunner runner;
      runner.addTest(test);
      runner.run();
      return 0;
    }
  catch (assertexception& e)
    {
      std::cerr << e.what() << std::endl;
      std::abort();
    }
}
开发者ID:drb27,项目名称:scantastic,代码行数:20,代码来源:test.cpp


示例15: main

int main(int argc, char *argv[])
{
  po::options_description opt(std::string("Usage: ") + argv[0] + " [Options] [Test Path] ...\nOptions");
  opt.add_options()
    ("help,h", "Print this help")
    ("verbose,v", "Verbose mode")
    ("test-path,t", po::value<std::vector<std::string> >(), "Specify the test path");
  po::positional_options_description p;
  p.add("test-path", -1);
  po::variables_map vars;
  try {
    po::store(po::command_line_parser(argc, argv).options(opt).positional(p).run(), vars);
    po::notify(vars);
    if (vars.count("help") != 0) {
      std::cerr << opt << std::endl;
      return 1;
    }
    if (vars.count("verbose") == 0) {
      Logger::get_instance().set_level(Logger::LEVEL_FATAL);
    }
  } catch (std::exception &e) {
    std::cerr << "Error: " << e.what() << std::endl;
    std::cerr << opt << std::endl;
    return 1;
  }
  CppUnit::TextTestRunner runner;
  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
  if (vars.count("test-path") > 0) {
    CppUnit::TestResult controller;
    CppUnit::TestResultCollector result;
    controller.addListener(&result);
    CppUnit::TextTestProgressListener progress;
    controller.addListener(&progress);
    const std::vector<std::string> &v = vars["test-path"].as<std::vector<std::string> >();
    BOOST_FOREACH(std::string i, v) {
      std::cout << i << " ";
      try {
	runner.run(controller, i);
      } catch (std::invalid_argument &e) {
	std::cerr << "ERROR: " << e.what() << std::endl;
	return 1;
      }
    }
开发者ID:iwadon,项目名称:junk,代码行数:43,代码来源:test_main.cpp


示例16: main

int main( int argc, char *argv[] )
{
  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();

  if ( (argc > 2) || ((argc > 1) && (string(argv[1]) == "--help")) ) {
    string app( argv[0] );
    cout << "Usage: " << app.substr( app.find_last_of('/') + 1 ) << " [test_case]" << endl
         << "Test cases:" << endl;

    for ( int i = 0; i < suite->getChildTestCount(); ++i )
      cout << "  " << suite->getChildTestAt(i)->getName() << endl;

    return 0;
  }

  CppUnit::TextTestRunner runner;
  runner.addTest( suite );

  return runner.run( (argc > 1) ? argv[1] : "" ) ? 0 : 1;
}
开发者ID:CodeMonkeySteve,项目名称:libfinagle,代码行数:20,代码来源:TestXML.cpp


示例17: main

int main(int argc, char *argv[])
{
	LoggingProxy::ProcessName("AlarmSourceTestCase");
	LoggingProxy *m_logger = new LoggingProxy (0, 0, 31, 0);
	LoggingProxy::init (m_logger);

	// initialize the AlarmSystemInterfaceFactory
	ACSAlarmSystemInterfaceFactory::init(NULL);

	CppUnit::TextTestRunner runner;
	runner.addTest( AcsAlarmTestCase::suite() );
	runner.run("",false,true,false);

	// close the AlarmSystemInterfaceFactory
	ACSAlarmSystemInterfaceFactory::done();

	m_logger->flush();
	LoggingProxy::done();
	delete m_logger;
}
开发者ID:ACS-Community,项目名称:ACS,代码行数:20,代码来源:testStructs.cpp


示例18: main

int main(/*int argc, char ** argv*/)
{
	// UnitTest
	CppUnit::TextTestRunner runner;
	runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter(&runner.result(), std::cerr));
	CppUnit::BriefTestProgressListener progress;
	runner.eventManager().addListener( &progress );
	CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
	runner.addTest( registry.makeTest() );
	runner.run();

	return 0;
}
开发者ID:blytkerchan,项目名称:arachnida,代码行数:13,代码来源:main.cpp


示例19: main

int main (int argc, char *argv[])
{

    // Start MPI if this is a parallel build.
#if RUNMPI == true
    MPI_Init(&argc, &argv);
#endif

    // Print a header message.
#if RUNMPI == true
    if (MPICommons::isMaster())
    {
        CppUnit::stdCOut() << std::endl << "Running KMCLib C++ unit tests on " << MPICommons::size() << " MPI processes." << std::endl;
    }
#else
    CppUnit::stdCOut() << std::endl << "Running KMCLib C++ unit tests." << std::endl;

#endif

    // Setup the tests.
    CppUnit::Test *test = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    CppUnit::TextTestRunner runner;
    runner.addTest(test);

    // Add our custom outputter.
    runner.setOutputter( new CustomOutputter(&runner.result(),
                                             std::cout) );

    // Add our custom progress listener.
    CppUnit::TestResult & event_manager = runner.eventManager();
    CustomProgressListener progress;
    event_manager.addListener( &progress );

    // Run the tests.
    runner.run(std::string(""), false, true, false);

    // Remove the progress listener.
    event_manager.removeListener( &progress );

    // Finalize if MPI.
#if RUNMPI == true
    MPI_Finalize();
#endif

    // DONE
    return 0;
}
开发者ID:PytLab,项目名称:KMCLib,代码行数:47,代码来源:testRunner.cpp


示例20: MWorksCoreTestMain

int MWorksCoreTestMain(int argc, char *argv[]) {
    if (argc < 2) {
        std::cerr << "Usage: " << argv[0] << " results_file [test_name ...]" << std::endl;
        return 2;
    }

    if (NULL != getenv("MWORKS_PAUSE_FOR_DEBUGGER")) {
        std::cerr << "Waiting for debugger to attach...";
        pause();
        std::cerr << " continuing" << std::endl;
    }

    CppUnit::TextTestRunner runner;

    std::ofstream outfile( argv[1] );
    CppUnit::XmlOutputter *outputter = new CppUnit::XmlOutputter(&runner.result(), outfile);
    runner.setOutputter(outputter);

    MWorksTestProgressListener listener;
    runner.eventManager().addListener( &listener );

    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry("Unit Test");
    runner.addTest( registry.makeTest() );

    bool returnval = true;
    if (argc > 2) {
        // Run specified tests
        for (int i = 2; i < argc; i++) {
            returnval = runner.run( argv[i], false, false, false ) && returnval;
        }
    } else {
        // Run all tests
        returnval = runner.run( "", false, false, false );
    }

    outputter->write();
    outfile.close();

    // return !returnval because it is 1 on success
    return !returnval;
}
开发者ID:BramVerhoef,项目名称:mworks,代码行数:41,代码来源:MWorksCoreTestMain.cpp



注:本文中的cppunit::TextTestRunner类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cppunit::WinTestRunner类代码示例发布时间:2022-05-31
下一篇:
C++ cppunit::TestSuite类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap