use of hudson.tasks.test.AggregatedTestResultAction.ChildReport in project jenkin-qtest-plugin by QASymphony.
the class PublishResultParser method parse.
@Override
public List<AutomationTestResult> parse(ParseRequest request) throws Exception {
Run<?, ?> build = request.getBuild();
TestResultAction resultAction = build.getAction(TestResultAction.class);
List<TestResult> testResults = new ArrayList<>();
if (resultAction != null) {
testResults.add(resultAction.getResult());
} else {
AggregatedTestResultAction aggregatedTestResultAction = build.getAction(AggregatedTestResultAction.class);
if (aggregatedTestResultAction != null) {
List<ChildReport> childReports = aggregatedTestResultAction.getResult();
if (childReports != null) {
for (ChildReport childReport : childReports) {
if (childReport.result instanceof TestResult) {
testResults.add((TestResult) childReport.result);
}
}
}
} else {
LoggerUtils.formatWarn(request.getListener().getLogger(), "No testResult action was added to project.");
}
}
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTimeInMillis(build.getStartTimeInMillis());
return CommonParsingUtils.toAutomationTestResults(request, testResults, gregorianCalendar.getTime());
}
Aggregations