use of org.kanonizo.junit.KanonizoTestFailure in project kanonizo by kanonizo.
the class JUnit4TestRunner method runTest.
@Override
public KanonizoTestResult runTest(TestCase tc) {
Request request = getRequest(tc);
Runner testRunner = request.getRunner();
Result testResult = runner.run(testRunner);
List<KanonizoTestFailure> failures = testResult.getFailures().stream().map(failure -> new KanonizoTestFailure(failure.getException(), failure.getTrace())).collect(Collectors.toList());
return new KanonizoTestResult(tc.getTestClass(), tc.getMethod(), testResult.wasSuccessful(), failures, testResult.getRunTime());
}
use of org.kanonizo.junit.KanonizoTestFailure in project kanonizo by kanonizo.
the class JUnit3TestRunner method runTest.
@Override
public KanonizoTestResult runTest(TestCase tc) {
Test test = createMethodSuite(tc.getTestClass(), tc.getMethod());
if (test == null) {
logger.error("Unable to create test case");
throw new RuntimeException();
}
long startTime = System.currentTimeMillis();
TestResult result = doRun(test, false);
long runTime = System.currentTimeMillis() - startTime;
List<KanonizoTestFailure> failures = new ArrayList<>();
Enumeration<TestFailure> testFailures = result.failures();
Enumeration<TestFailure> errors = result.errors();
List<TestFailure> allErrors = Util.combine(testFailures, errors);
for (TestFailure f : allErrors) {
failures.add(new KanonizoTestFailure(f.thrownException(), f.trace()));
}
return new KanonizoTestResult(tc.getTestClass(), tc.getMethod(), result.wasSuccessful(), failures, runTime);
}
Aggregations