void TestRegistry::listTestGroupAndCaseNames(TestResult& result)
{
    SimpleString groupAndNameList;

    for (UtestShell *test = tests_; test != NULL; test = test->getNext()) {
        if (testShouldRun(test, result)) {
            SimpleString groupAndName;
            groupAndName += "#";
            groupAndName += test->getGroup();
            groupAndName += ".";
            groupAndName += test->getName();
            groupAndName += "#";

            if (!groupAndNameList.contains(groupAndName)) {
                groupAndNameList += groupAndName;
                groupAndNameList += " ";
            }
        }
    }

    groupAndNameList.replace("#", "");

    if (groupAndNameList.endsWith(" "))
        groupAndNameList = groupAndNameList.subString(0, groupAndNameList.size() - 1);
    result.print(groupAndNameList.asCharString());
}
Beispiel #2
0
void MemoryReporterPlugin::preTestAction(UtestShell& 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);
}
UtestShell* TestRegistry::findTestWithGroup(const SimpleString& group)
{
    UtestShell* current = tests_;
    while (current) {
        if (current->getGroup() == group)
            return current;
        current = current->getNext();
    }
    return NULL;
}
void NormalMemoryReportFormatter::report_testgroup_start(TestResult* result, UtestShell& test)
{
	const size_t line_size = 80;

	SimpleString groupName = StringFromFormat("TEST GROUP(%s)", test.getGroup().asCharString());
	size_t beginPos = (line_size/2) - (groupName.size()/2);

	SimpleString line("-", beginPos);
	line += groupName;
	line += SimpleString("-", line_size - line.size());
	line += "\n";
	result->print(line.asCharString());
}
void JUnitTestOutput::printCurrentTestStarted(const UtestShell& test)
{
	impl_->results_.testCount_++;
	impl_->results_.group_ = test.getGroup();
	impl_->results_.startTime_ = GetPlatformSpecificTimeInMillis();

	if (impl_->results_.tail_ == 0) {
		impl_->results_.head_ = impl_->results_.tail_
				= new JUnitTestCaseResultNode;
	}
	else {
		impl_->results_.tail_->next_ = new JUnitTestCaseResultNode;
		impl_->results_.tail_ = impl_->results_.tail_->next_;
	}
	impl_->results_.tail_->name_ = test.getName();
}
Beispiel #6
0
void JUnitTestOutput::printCurrentTestStarted(const UtestShell& test)
{
    impl_->results_.testCount_++;
    impl_->results_.group_ = test.getGroup();
    impl_->results_.startTime_ = GetPlatformSpecificTimeInMillis();

    if (impl_->results_.tail_ == NULLPTR) {
        impl_->results_.head_ = impl_->results_.tail_
                = new JUnitTestCaseResultNode;
    }
    else {
        impl_->results_.tail_->next_ = new JUnitTestCaseResultNode;
        impl_->results_.tail_ = impl_->results_.tail_->next_;
    }
    impl_->results_.tail_->name_ = test.getName();
    impl_->results_.tail_->file_ = test.getFile();
    impl_->results_.tail_->lineNumber_ = test.getLineNumber();
    if (!test.willRun()) {
        impl_->results_.tail_->ignored_ = true;
    }
}
void NormalMemoryReportFormatter::report_test_end(TestResult* result, UtestShell& test)
{
	result->print(StringFromFormat("ENDTEST(%s, %s)\n", test.getGroup().asCharString(), test.getName().asCharString()).asCharString());
}
void CodeMemoryReportFormatter::report_testgroup_start(TestResult* result, UtestShell& test)
{
	result->print(StringFromFormat("*/TEST_GROUP(%s_memoryReport)\n{\n};\n/*",
			test.getGroup().asCharString()).asCharString());
}
void CodeMemoryReportFormatter::report_test_start(TestResult* result, UtestShell& test)
{
	clearReporting();
	result->print(StringFromFormat("*/\nTEST(%s_memoryReport, %s)\n{ /* at %s:%d */\n",
			test.getGroup().asCharString(), test.getName().asCharString(), test.getFile().asCharString(), test.getLineNumber()).asCharString());
}