示例#1
0
void TestRegistry::runAllTests (TestResult& result)
{
	bool groupStart = true;

	result.testsStarted ();
	for (Utest *test = tests; !test->isNull(); test = test->getNext ()){

		if (groupStart) {
			result.currentGroupStarted(test);
			groupStart = false;
		}

		result.setProgressIndicator(test->getProgressIndicator());
		result.countTest();
		if (testShouldRun(test, result)) {
			result.currentTestStarted(test);
			test->runOneTestWithPlugins(firstPlugin_, result);
			result.currentTestEnded(test);
		}

		if (endOfGroup (test)) {
			groupStart = true;
			result.currentGroupEnded(test);
		}
	}
  result.testsEnded ();
}
示例#2
0
Utest* TestRegistry::getTestWithNext(Utest* test)
{
   Utest* current = tests;
   while (!current->getNext()->isNull() && current->getNext() != test)
      current = current->getNext();
   return current;
}
示例#3
0
Utest* TestRegistry::getLastTest()
{
   Utest* current = tests;
   while (!current->getNext()->isNull())
      current = current->getNext();
   return current;
}
示例#4
0
void JUnitTestOutput::printCurrentTestStarted(const Utest& test)
{
	results_.testCount_++;
	results_.group_ = test.getGroup();
	results_.startTime_ = GetPlatformSpecificTimeInMillis();
	
	if (results_.tail_ == 0) {
		results_.head_ = results_.tail_ = new JUnitTestCaseResultNode;
	}
	else {
		results_.tail_->next_ = new JUnitTestCaseResultNode; 
		results_.tail_ = results_.tail_->next_; 
	}
	results_.tail_->name_ = test.getName(); 
}
void MemoryReporterPlugin::preTestAction(Utest& test, TestResult& result)
{
	if (formatter_ == NULL) return;

	initializeAllocator(&mallocAllocator, result);
	initializeAllocator(&newAllocator, result);
	initializeAllocator(&newArrayAllocator, result);

	setGlobalMemoryReportAllocators();

	if (test.getGroup() != currentTestGroup_) {
		formatter_->report_testgroup_start(&result, test);
		currentTestGroup_ = test.getGroup();
	}

	formatter_->report_test_start(&result, test);
}
void MemoryReporterPlugin::postTestAction(Utest& test, TestResult& result)
{
	if (formatter_ == NULL) return;

	removeGlobalMemoryReportAllocators();
	formatter_->report_test_end(&result, test);

	if (test.getNext()->getGroup() != currentTestGroup_)
		formatter_->report_testgroup_end(&result, test);
}
示例#7
0
void UtestShell::runOneTestInCurrentProcess(TestPlugin* plugin, TestResult& result)
{
    plugin->runAllPreTestAction(*this, result);

    //save test context, so that test class can be tested
    UtestShell* savedTest = UtestShell::getCurrent();
    TestResult* savedResult = UtestShell::getTestResult();

    result.countRun();
    UtestShell::setTestResult(&result);
    UtestShell::setCurrentTest(this);

    Utest* testToRun = createTest();
    testToRun->run();
    destroyTest(testToRun);

    UtestShell::setCurrentTest(savedTest);
    UtestShell::setTestResult(savedResult);

    plugin->runAllPostTestAction(*this, result);
}
void TestOutput::printCurrentTestStarted(const Utest& test)
{
	if (verbose_) print(test.getFormattedName().asCharString());
}