Search in sources :

Example 6 with FailureMirror

use of com.carrotsearch.ant.tasks.junit4.events.mirrors.FailureMirror in project randomizedtesting by randomizedtesting.

the class AntXmlReport method buildModel.

/* */
private List<TestCaseModel> buildModel(List<AggregatedTestResultEvent> testEvents) {
    List<TestCaseModel> tests = new ArrayList<>();
    for (AggregatedTestResultEvent e : testEvents) {
        TestCaseModel model = new TestCaseModel();
        if (e.getStatus() == TestStatus.IGNORED || e.getStatus() == TestStatus.IGNORED_ASSUMPTION) {
            if (mavenExtensions) {
                // This emits an empty <skipped /> element.
                model.skipped = "";
            } else {
                // No way to report these in pure ANT XML.
                continue;
            }
        }
        model.name = applyFilters(e.getDescription().getMethodName());
        model.classname = e.getDescription().getClassName();
        model.time = e.getExecutionTime() / 1000.0;
        for (FailureMirror m : e.getFailures()) {
            if (m.isAssumptionViolation()) {
                // Assumptions are not represented in ANT or Maven XMLs.
                continue;
            } else if (m.isAssertionViolation()) {
                model.failures.add(buildModel(m));
            } else {
                model.errors.add(buildModel(m));
            }
        }
        tests.add(model);
    }
    return tests;
}
Also used : AggregatedTestResultEvent(com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent) ArrayList(java.util.ArrayList) FailureMirror(com.carrotsearch.ant.tasks.junit4.events.mirrors.FailureMirror)

Aggregations

FailureMirror (com.carrotsearch.ant.tasks.junit4.events.mirrors.FailureMirror)6 Date (java.util.Date)3 AggregatedTestResultEvent (com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent)2 StringWriter (java.io.StringWriter)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)1 Description (org.junit.runner.Description)1