Search in sources :

Example 1 with JUnitParser

use of hudson.tasks.junit.JUnitParser in project jenkin-qtest-plugin by QASymphony.

the class PatternScanParser method parse.

/**
 * Read test results with test result location pattern
 *
 * @param request            request
 * @param testResultLocation testResultLocation
 * @return a list of {@link AutomationTestResult}
 * @throws Exception Exception
 */
public List<AutomationTestResult> parse(ParseRequest request, String testResultLocation) throws Exception {
    JUnitParser jUnitParser = new JUnitParser(true);
    Run<?, ?> build = request.getBuild();
    Launcher launcher = request.getLauncher();
    TaskListener listener = request.getListener();
    List<TestResult> testResults = new ArrayList<>();
    testResults.add(jUnitParser.parseResult(testResultLocation, build, request.getWorkSpace(), launcher, listener));
    GregorianCalendar gregorianCalendar = new GregorianCalendar();
    gregorianCalendar.setTimeInMillis(build.getStartTimeInMillis());
    return CommonParsingUtils.toAutomationTestResults(request, testResults, gregorianCalendar.getTime());
}
Also used : TaskListener(hudson.model.TaskListener) ArrayList(java.util.ArrayList) GregorianCalendar(java.util.GregorianCalendar) JUnitParser(hudson.tasks.junit.JUnitParser) Launcher(hudson.Launcher) TestResult(hudson.tasks.junit.TestResult) AutomationTestResult(com.qasymphony.ci.plugin.model.AutomationTestResult)

Aggregations

AutomationTestResult (com.qasymphony.ci.plugin.model.AutomationTestResult)1 Launcher (hudson.Launcher)1 TaskListener (hudson.model.TaskListener)1 JUnitParser (hudson.tasks.junit.JUnitParser)1 TestResult (hudson.tasks.junit.TestResult)1 ArrayList (java.util.ArrayList)1 GregorianCalendar (java.util.GregorianCalendar)1