use of org.sonar.api.test.TestCase in project sonarqube by SonarSource.
the class GenericTestExecutionReportParser method parseTestCase.
private void parseTestCase(SMInputCursor cursor, MutableTestPlan testPlan) throws XMLStreamException {
checkElementName(cursor, "testCase");
MutableTestCase testCase = testPlan.addTestCase(mandatoryAttribute(cursor, NAME_ATTR));
TestCase.Status status = TestCase.Status.OK;
testCase.setDurationInMs(longValue(mandatoryAttribute(cursor, DURATION_ATTR), cursor, DURATION_ATTR, 0));
SMInputCursor child = cursor.descendantElementCursor();
if (child.getNext() != null) {
String elementName = child.getLocalName();
if (SKIPPED.equals(elementName)) {
status = TestCase.Status.SKIPPED;
} else if (FAILURE.equals(elementName)) {
status = TestCase.Status.FAILURE;
} else if (ERROR.equals(elementName)) {
status = TestCase.Status.ERROR;
}
if (TestCase.Status.OK != status) {
testCase.setMessage(mandatoryAttribute(child, MESSAGE_ATTR));
testCase.setStackTrace(child.collectDescendantText());
}
}
testCase.setStatus(status);
}
Aggregations