-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework MavenConsoleLineTracker #521
Conversation
Improvements for Debugger-Connection: - launch Remote-Java-Application immediately when a forked VM waiting for a debugger-connection is detected instead of only creating a link - fix debug listening detection (and port computation) when lines start with [INFO] - set the project under test as project of the debug-launch (makes sources immediately available) Improvements for Test-Report links: - open JUnit-Test-Report if available (instead of plain test-file) - speed up search for test-report files (search only in project's target folder and not in entire working-dir) - fix test-report link opening when baseDir contains variables - fix test-name computation and test-report link alignment when lines start with [INFO] - add tests for test-report links and automatic debugger attachment
@@ -69,59 +75,63 @@ | |||
|
|||
private static final String RUNNING_MARKER = "Running "; | |||
|
|||
private static final String TEST_TEMPLATE = "(?: )test.+\\(([\\w\\.]+)\\)"; //$NON-NLS-1$ | |||
private static final Pattern TEST_CLASS_PATTERN = Pattern.compile("(?: )test.+\\(([\\w\\.]+)\\)"); //TODO: what does this match? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what kind of lines this Pattern is intended to match? Lines that contain any fully qualified class name that starts with test
and is prefixed with two spaces?
If yes the Pattern seems to be wrong, because I suspect the first dot should have been escaped, so the following capturing group likely only captured one symbol.
Furthermore if the fully-qualified class name starts with test.
one will not find it without that first name element.
For me it looks like it would only work if a Maven-plugin prints test.
+test-class-name for a executed test-class.
Does anybody know such plugin?
If not, I suggest to remove that Pattern entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this pattern is meant to capute testMethod (starting by test
, .+
being the other names of the method, and the other part capturing paramters. This is probably used in order to like to method when some test failures are reported.
IMO, we should keep it, however we should improve it (later) so that it doesn't rely on the assumption that test methods start by test
.
Just a general question: Why do we need to parse the console output? Should the surefire reports not be a better source for actual test classes names? |
Some people like to run Maven builds from the IDE, and those builds may include tests, and in such case, it's convenient to link class names to failed methods directly to the console so people can see in 1 click where the failure happens. |
Sure but shouldn't we parse the names of the test from the results directory and then match those to the console? |
Maybe ;) |
Yes, this was just something that came into my mind about that "magic regexp" stuff might better be handled explicitly. |
That's right. I find this very handy, especially with the improvements intended to introduce with this change that the JUnit-View is opened to display the test report. Furthermore it significantly simplifies debugging of forked VMs (like for Unit-tests) because the launch of the debugger is setup and (from now on) started automatically. With PR #471 this should become even simpler and debugging forked is as simple as debugging regular applications.
Which names are you referring to exactly? To the names of failed tests or to the names of Running tests? Nevertheless I think it is reasonable to parse at least the current's project GAV from the console to then query it from the project registry, because it allows to restrict the search-space for test-report files (when ever they are searched). I tried to make the read of those project information as performant as possible. Additionally it will allow for example to put links to a project's pom into the console, which I think could be a handy feature in the future. However we could consider to further restrict the search space for test-reports in the target-folder if we expect that the surefire/failssafe (and the tycho pendants) never change their
I'm about to restore the |
If you are fine with this change as it is, I will squash-and-merge it. |
+1 to squash and merge now. |
Thanks for the discussion. |
This PR has the goal to improve the experience with the functionality provided by the
MavenConsoleLineTracker
and is a preparatory step for PR #471. It is a major rework of theMavenConsoleLineTracker
and addresses the following points:Improvements for Debugger-Connection:
Improvements for Test-Report links:
add tests for test-report links and automatic debugger attachment