Search in sources :

Example 1 with Status

use of org.sonar.scanner.deprecated.test.DefaultTestCase.Status in project sonarqube by SonarSource.

the class GenericTestExecutionReportParser method parseTestCase.

private static void parseTestCase(SMInputCursor cursor, DefaultTestPlan testPlan) throws XMLStreamException {
    checkElementName(cursor, "testCase");
    DefaultTestCase testCase = testPlan.addTestCase(mandatoryAttribute(cursor, NAME_ATTR));
    Status status = 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 = Status.SKIPPED;
        } else if (FAILURE.equals(elementName)) {
            status = Status.FAILURE;
        } else if (ERROR.equals(elementName)) {
            status = Status.ERROR;
        }
        if (Status.OK != status) {
            testCase.setMessage(mandatoryAttribute(child, MESSAGE_ATTR));
        }
    }
    testCase.setStatus(status);
}
Also used : Status(org.sonar.scanner.deprecated.test.DefaultTestCase.Status) SMInputCursor(org.codehaus.staxmate.in.SMInputCursor) DefaultTestCase(org.sonar.scanner.deprecated.test.DefaultTestCase)

Aggregations

SMInputCursor (org.codehaus.staxmate.in.SMInputCursor)1 DefaultTestCase (org.sonar.scanner.deprecated.test.DefaultTestCase)1 Status (org.sonar.scanner.deprecated.test.DefaultTestCase.Status)1