-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Attempting to rerun failing JUnit 4 Parameterized tests in IDEA fails #1386
Comments
IDEA should actually use the unique ID of the test to select an individual invocation of a parameterized test to re-run it. Thus, if IDEA is selecting the individual parameterized invocation via @akozlova, thoughts? |
IDEA started to support uniqueIDs starting from 2018.1 (before that uniqueIds were not supported in standard engines). In other words, works fine here with latest released IDEA version. |
Thanks, @akozlova! 👍 I assumed that was the case (just wasn't sure of the version of IDEA that supported unique IDs). I am therefore closing this issue. @paulduffin, if you are using a version of IDEA prior to 2018.1, please upgrade to that version. |
The issue is happening to me when I change the name of the test.
Then I get:
If I leave the Junit version 4.12, can this be related or should I open another issue? |
Overview
Am using version 5.1.1
In IDEA run a JUnit 4 Parameterized test class which has one test method that fails. Attempt to rerun the failing test and it fails with the following error:
org.junit.platform.commons.util.PreconditionViolationException: Could not find method with name [foo[parameter]] in class [ParameterizedTest].
Although this happens in IDEA I don't think that this is a bug in IDEA. It seems as though there is an inconsistency between how org.junit.runners.Parameterized test formats a parameterized test and how org.junit.platform.engine.discovery.DiscoverySelectors#selectMethod(java.lang.String) expects a parameterized test to be formatted.
The former uses "class#method[parameters]", the latter expects "class#method(parameters)". That results in the methodName field of the MethodSelector object being set to "method[parameters]" instead of "method" which means that the org.junit.vintage.engine.discovery.MethodSelectorResolver#resolve(...) method fails to find method.
Couple of possible approaches:
The latter approach seems the best one to me as it places the logic for handling JUnit 4 code in the vintage engine which is where it belongs.
Deliverables
The text was updated successfully, but these errors were encountered: