Search in sources :

Example 1 with TestRunResult

use of com.hp.octane.integrations.dto.tests.TestRunResult in project octane-gitlab-service by MicroFocus.

the class JunitTestResultsProvider method addTestCase.

private void addTestCase(List<TestRun> result, Testsuite ts, Testcase tc) {
    TestRunResult testResultStatus;
    if (tc.getSkipped() != null && tc.getSkipped().trim().length() > 0) {
        testResultStatus = TestRunResult.SKIPPED;
    } else if (tc.getFailure().size() > 0) {
        testResultStatus = TestRunResult.FAILED;
    } else {
        testResultStatus = TestRunResult.PASSED;
    }
    TestRun tr = dtoFactory.newDTO(TestRun.class).setModuleName("").setPackageName(ts.getPackage()).setClassName(tc.getClassname()).setTestName(tc.getName()).setResult(testResultStatus).setDuration(tc.getTime() != null ? Double.valueOf(tc.getTime()).longValue() * 1000 : 1);
    if (tc.getError() != null && tc.getError().size() > 0) {
        TestRunError error = dtoFactory.newDTO(TestRunError.class);
        error.setErrorMessage(tc.getError().get(0).getMessage());
        error.setErrorType(tc.getError().get(0).getType());
        error.setStackTrace(tc.getError().get(0).getContent());
        tr.setError(error);
    } else if (tc.getFailure() != null && tc.getFailure().size() > 0) {
        TestRunError error = dtoFactory.newDTO(TestRunError.class);
        error.setErrorMessage(tc.getFailure().get(0).getMessage());
        error.setErrorType(tc.getFailure().get(0).getType());
        error.setStackTrace(tc.getFailure().get(0).getContent());
        tr.setError(error);
    }
    result.add(tr);
}
Also used : TestRun(com.hp.octane.integrations.dto.tests.TestRun) TestRunError(com.hp.octane.integrations.dto.tests.TestRunError) TestRunResult(com.hp.octane.integrations.dto.tests.TestRunResult)

Aggregations

TestRun (com.hp.octane.integrations.dto.tests.TestRun)1 TestRunError (com.hp.octane.integrations.dto.tests.TestRunError)1 TestRunResult (com.hp.octane.integrations.dto.tests.TestRunResult)1