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

	// Create the event manager and test controller
	TestResult controller;

	// Add a listener that colllects test result
	TestResultCollector result;
	controller.addListener(&result);

	// Add a listener that print dots as test run.
	BriefTestProgressListener progress;
	controller.addListener(&progress);

	TextUi::TestRunner runner;
	TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry();
	runner.addTest(registry.makeTest());

	std::cout << std::endl << " === Running Tests " << std::endl;

	runner.run(controller);

	// Print test in a compiler compatible format.
	std::cout << std::endl << " === Test Results" << std::endl;

	CompilerOutputter outputter(&result, stdCOut());
	outputter.write();

	ofstream xmlFile("data/cpptestresults.xml");
	XmlOutputter xmlOut(&result, xmlFile);
	xmlOut.write();



	return result.wasSuccessful() ? 0 : 1;
}
Exemple #2
0
int main(int argc, char **argv) {
    // Create the event manager and test controller
    TestResult controller;
    
    // Add a listener that collects test result
    TestResultCollector result;
    controller.addListener(&result);
    
    // Add the top suite to the test runner
    TestRunner runner;
    runner.addTest(TestFactoryRegistry::getRegistry().makeTest());

    // Listen to progress
    TestListener *listener;
    
    if (jetbrains::teamcity::underTeamcity()) {
        // Add unique flowId parameter if you want to run test processes in parallel
        // See http://confluence.jetbrains.net/display/TCD6/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-MessageFlowId
        listener = new jetbrains::teamcity::TeamcityProgressListener();
    } else {
        listener = new BriefTestProgressListener();
    }
    controller.addListener(listener);

    // Run tests
    runner.run(controller);
    
    delete listener;
    
    return result.wasSuccessful() ? 0 : 1;
}
int main(int argc, char **argv)
{
    // Create the event manager and test controller
    TestResult controller;

    // Add a listener that collects test result
    TestResultCollector result;
    controller.addListener(&result);

    // Add the top suite to the test runner
    TestRunner runner;
    runner.addTest(TestFactoryRegistry::getRegistry().makeTest());

    // Listen to progress
    TestListener *listener;

    if (JetBrains::underTeamcity())
    {
        listener = new JetBrains::TeamcityProgressListener();
    }
    else
    {
        listener = new BriefTestProgressListener();
    }

    controller.addListener(listener);

    // Run test
    runner.run(controller);

    delete listener;

    return result.wasSuccessful() ? 0 : 1;
}
Exemple #4
0
int main(int argc, char* argv[])
{
    TestOption& option = TestOption::Instance();
    //命令行解析测试
    if(!option.init(argc,argv))
    {
        return -1;
    }

    //设置过滤器
    TestFilter filter;
    filter.setCondition(option.getFilterString());
    TestRegistry::setTestFilter(&filter);

    //设置输出方式
    TestResult tr;
    TextOutputter outputter(&tr);
    outputter.setShowMode(option.isShowAll());
    tr.addListener(&outputter);

    //设置全局环境
    AddGlobalTestEnvironment(new TestEnv);

    //设置重复执行的次数
    TestRegistry::runAllTests(tr, option.getRepeatTimes());

//    //ini文件解析测试
//    FileParse::parse("StackTest.ut");
//    FileParse::close();
//
//    //Executor测试
//    TestCmdExecutor::execute("groupname_testname1",STEP_PRETEST,FileParse::getTestCmdArray());
    return 0;
}
int main(int argc, char *argv[]) {

	if(argc < 2) {
        printf("Usage: %s <lua plugin file name>\n", argv[0]);
        printf("for example: %s mytest.lua\n", argv[0]);
		return 0;
	}

    // load the test case plugin
    printf("Loading the plugin... \n");
    LuaPluginLoader loader;
    TestCase* test = loader.open(argv[1]);
    if(test == NULL) {
        printf("%s\n", loader.getLastError().c_str());
        return 0;
	}

    // create a test listener to collect the result
    ConsoleListener listener(false);

    // create a test result and add the listeners
    TestResult result;
    result.addListener(&listener);

    // create a test runner and run the test case
    TestRunner runner;
    runner.addTest(test);
    runner.run(result);

    return 0;
}
/*
 * Run the test suite, return 0 on success, 1 on error.
 */
int main(void) {


	TestResult controller;

	TestResultCollector result;
	controller.addListener(&result);

	BriefTestProgressListener progress;
	controller.addListener(&progress);

	TestRunner runner;
	runner.addTest( TestFactoryRegistry::getRegistry().makeTest() );
	runner.run(controller);

	CompilerOutputter outputter(&result, std::cerr);
	outputter.write();

	return result.wasSuccessful() ? 0 : 1;
}
Exemple #7
0
int main(int argc, char** argv)
{
	TestResult testresult;
	TestResultCollector collectedresults;
    BriefTestProgressListener progress;

    testresult.addListener(&collectedresults);
    testresult.addListener(&progress);

    TestRunner testrunner;
    testrunner.addTest (TestFactoryRegistry::getRegistry().makeTest());
    testrunner.run(testresult);

    CompilerOutputter compileroutputter(&collectedresults, std::cerr);
    compileroutputter.write();

	// Output XML for Jenkins CPPunit plugin
	/*ofstream xmlFileOut("cppTestBasicMathResults.xml");
	XmlOutputter xmlOut(&collectedresults, xmlFileOut);
	xmlOut.write();*/

    return collectedresults.wasSuccessful() ? 0 : 1;
}
Exemple #8
0
int main(int argc, char **argv) {
    TestResult controller;
    TestResultCollector result;
    controller.addListener(&result);

    BriefTestProgressListener progress;
    controller.addListener(&progress);

    TestRunner runner;
    runner.addTest(TestFactoryRegistry::getRegistry().makeTest());
    runner.run(controller);

    // compiler output
    CompilerOutputter coutputter(&result, stdCOut());
    coutputter.write();

    // output test result for jenkins 
    std::ofstream ofs("test_result.xml");
    CPPUNIT_NS::XmlOutputter outputter(&result, ofs,"UTF-8");
    outputter.write();

    return result.wasSuccessful() ? 0 : 1;
}
Exemple #9
0
/**
 * Runs the unit tests, producing the results in a xml file and printing to the screen.
 * @param  outputFile Xml file to place output.
 * @return            0.
 */
int runXml(string outputFile)
{
  TestResult controller;
  TestResultCollector result;
  controller.addListener(&result);

  // BriefTestProgressListener progress;
  // controller.addListener( &progress );

  TextUi::TestRunner runner;
  runner.addTest( TestFactoryRegistry::getRegistry().makeTest() );
  runner.run( controller );

  ofstream xmlFileOut(outputFile.c_str());
  XmlOutputter xmlOut(&result, xmlFileOut);
  xmlOut.write();

  return 0;
}
    virtual void run() {
        TestResultCollector collector;

        // create a test result and add the listeners
        TestResult result;
        result.addListener(&collector);

        // create a test runner
        TestRunner runner;
        MyTest test1;
        MyTest2 test2;
        runner.addTest(&test1);
        runner.addTest(&test2);
        runner.run(result);

        //RTF_TEST_REPORT(Asserter::format("count: %d", collector.failedCount()));
        RTF_TEST_CHECK(collector.testCount() == 2, "Checking tests count");
        RTF_TEST_CHECK(collector.passedCount() == 1, "Checking passed count");
        RTF_TEST_CHECK(collector.failedCount() == 1, "Checking failed count");
    }