From 8e210803cd0e1b854a27283b2de834c28e946112 Mon Sep 17 00:00:00 2001 From: Will Hains Date: Sun, 19 Jan 2014 22:20:40 +0900 Subject: [PATCH] Patch submission for #14. Define a custom problem marker type for test failures. When a JUnitLoop test session starts, remove all test failure markers from the workspace. On each test failure, create a new test failure marker, which appears in the Problems view and links to the line in the test case where the failure occurred. --- de.devboost.eclipse.junitloop/plugin.xml | 6 ++ .../junitloop/JUnitLoopTestRunListener.java | 56 ++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/de.devboost.eclipse.junitloop/plugin.xml b/de.devboost.eclipse.junitloop/plugin.xml index dedb345..2d544e4 100644 --- a/de.devboost.eclipse.junitloop/plugin.xml +++ b/de.devboost.eclipse.junitloop/plugin.xml @@ -14,6 +14,12 @@ class="de.devboost.eclipse.junitloop.JUnitLoopTestRunListener"> + + + 0) { + final String line = traceLine.substring( + traceLine.indexOf(':') + 1, traceLine.length() - 1); + try { + final IType testClassType = launchedProject + .findType(testClassName); + final IResource resource = testClassType.getResource(); + + final IMarker marker = resource + .createMarker(MARKER_TEST_FAILURE); + marker.setAttribute(IMarker.MESSAGE, traceLine1); + marker.setAttribute(IMarker.SEVERITY, + IMarker.SEVERITY_WARNING); + marker.setAttribute(IMarker.LINE_NUMBER, + Integer.parseInt(line)); + marker.setAttribute(IMarker.LOCATION, "line " + line); + marker.setAttribute(IMarker.TRANSIENT, true); + + break; + } catch (final Exception e) { + JLoopPlugin.logError("Couldn't write problem marker", e); + } + } + } + } + private TestClass createTestClass(String testClassName) { // create local copy to avoid potential multi-threading problems IJavaProject localProject = launchedProject;