use of com.hp.octane.integrations.dto.tests.TestRunError 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);
}
Aggregations