Search in sources :

Example 1 with ChildReport

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());
}
Also used : AggregatedTestResultAction(hudson.tasks.test.AggregatedTestResultAction) ChildReport(hudson.tasks.test.AggregatedTestResultAction.ChildReport) ArrayList(java.util.ArrayList) GregorianCalendar(java.util.GregorianCalendar) TestResult(hudson.tasks.junit.TestResult) AutomationTestResult(com.qasymphony.ci.plugin.model.AutomationTestResult) TestResultAction(hudson.tasks.junit.TestResultAction) AggregatedTestResultAction(hudson.tasks.test.AggregatedTestResultAction)

Aggregations

AutomationTestResult (com.qasymphony.ci.plugin.model.AutomationTestResult)1 TestResult (hudson.tasks.junit.TestResult)1 TestResultAction (hudson.tasks.junit.TestResultAction)1 AggregatedTestResultAction (hudson.tasks.test.AggregatedTestResultAction)1 ChildReport (hudson.tasks.test.AggregatedTestResultAction.ChildReport)1 ArrayList (java.util.ArrayList)1 GregorianCalendar (java.util.GregorianCalendar)1