-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support FilePosition in discovery selectors #2146
Comments
Good points! Note that we actually already have support for See Thus, adding the support proposed in this issue would align our I am therefore in favor of adding this support to selectors. @junit-team/junit-lambda, thoughts? |
Tentatively slated for 5.7 M1 for team discussion |
Team decision: Add Challenge: |
Hi! First time contributor here; I've started out with adding Not sure if this was as intended; and it's likely nowhere near done to resolve this issue, but I'd like to get some feedback on what should be the next logical steps. To start with:
Any further guidance would be much appreciated; I had thought to open a pull request only if it seems feasible I'll be able to finish the implementation. |
@timtebeek Sorry for the delay in response, I hope you're still interested. 🙂
We wouldn't like to duplicate the
Yes, since all new constructors should be package-private. |
No problem at all; happy to help out.
Any suggestions as to where to place it? It's my first time contributing here, so not too familiar with where it should go.
Perfect; will do! |
I'm leaning towards adding it to |
@marcphilipp I've applied your suggestions and opened up #2253 for further discussion. :) |
This commit adds the possibility to select files and classpath resources with a given `FilePosition` (line and/or column number). Resolves #2146.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
There was no good way to discover and execute a single test when using a file based test system like Cucumber. Recently JUnit added support for file position in the `FileSelector` and `ClasspathResourceSelector`. See: junit-team/junit5#2146 This implements a filter that prunes all scenarios that do not match the `FilePosition` from the discovery selector. This feature itself is not new. It was already implemented for the `UriSelector`.
Currently there is no good way to discover and execute a single test when using a file based test system like Cucumber. So I would like to request support for a file position in
UriSelector
,FileSelector
andClasspathResourceSelector
.Deliverables
Support for a file position when using:
Motivation
Cucumber executes feature files written in Gherkin. A feature file consists of multiple scenarios organized in a hierarchical structure. A project may contain multiple feature files, typically organized in some directory structure.
For example:
Contents of
outline.feature
:outline.feature
contains 5 tests in a hierarchy:Now suppose I would like select both tests (
Example #1
,Example #2
) nested under the exampleWith some text
on line 17.Currently JUnit discovery selectors (
ClasspathRootSelector
,ClasspathResourceSelector
,PackageSelector
,FileSelector
,DirectorySelector
) only allow me to discover all tests in a single directory or file.The
UniqueIdSelector
could be used to select theWith some text
container but requires reproducing the unique id which is rather complicated and quite possibly an implementation detail that should not be relied upon.Cucumbers current
TestEngine
implementation currently allows for aline
query parameter to be added in when parsing using theUriSelector
. For example:classpath:/com/example/outline.feature?line=17
file:/home/mpkorstanje/projects/cucumber/src/test/resources/com/example/outline.feature?line=17
Since this is not formalized I suspect other test engines that consume the
UriSelector
may crash on the query parameter and so I would like something safer.For IDEs being able to use a
FileSelector
with a file position would also simplify the complexity of providing support for file based test engines. Naively allowing the user to select any line in a file and execute the discovered tests for that line would provide for a minimal implementation without knowing any details about the underlying implementation of the test engine.The same reasoning applies to
ClasspathResourceSelector
.The text was updated successfully, but these errors were encountered: