-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use Gherkin v4 #1035
Use Gherkin v4 #1035
Conversation
95b15a2
to
ecfc554
Compare
You are a machine @brasmusson ! I'll do everything I can to cut a new release this week. Thanks for your awesome work. |
e14c980
to
b339d0c
Compare
b339d0c
to
832c378
Compare
832c378
to
1031db6
Compare
@aslakhellesoy are you the only person who can make releases? Is there anyone else with the experience / authority to merge this PR? Seems a shame for this to get stuck for so long just because you're busy. |
Use the new tag-expressions library, but support both the use of the new tag expression syntax and the old tag expression syntax.
1031db6
to
1af20c5
Compare
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.
Reviewed up to 51c8656
- Might be worth putting this on the backlog. Maven Relocation
- Is there a reason not to match the package structure to the groupId? E.g.
io.cucumber.api
rather thencucumber.api
?
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.
Reviewed the [JUnit] changes
Would suggest moving contents of cucumber.runtime.junit
into cucumber.api.junit
so all classes aside from Cucumber
can be package private.
PickleWrapper and PickleStepWrapper implement Serializable but their contents is not serializable (infact, their contents is not needed at all).
I don't quite understand SanityChecker. Should probably be in test sources.
Submitted nitpicks as #1122. No point in writing them out.
|
||
public ExecutionUnitRunner(Runtime runtime, CucumberScenario cucumberScenario, JUnitReporter jUnitReporter) throws InitializationError { | ||
public ExecutionUnitRunner(Runner runner, PickleEvent pickleEvent, JUnitReporter jUnitReporter) throws InitializationError { | ||
super(ExecutionUnitRunner.class); |
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.
As far as I can tell this should be super(null). There is no reason to scan this class for annotations.
ScenarioImpl scenarioResult = new ScenarioImpl(bus, pickleEvent.pickle); | ||
for (TestStep step : testSteps) { | ||
Result stepResult = step.run(bus, pickleEvent.pickle.getLanguage(), scenarioResult, skipNextStep); | ||
if (stepResult.getStatus() != Result.PASSED) { |
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 guess you intended this to be an enum comparison not a string?
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.
This is also causing problems in TestNgReporter#result. It compares strings against objects for Result.UNDEFINED.
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.
Now that the Result class has moved to this project from gherkin, there is an opportunity improve things like the definition of status codes. I'll look into that.
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.
By the introduction of an enum for the result statuses in #1133, this kind of problem should be eliminated.
@@ -57,10 +62,10 @@ public Cucumber(Class clazz) throws InitializationError, IOException { | |||
|
|||
ResourceLoader resourceLoader = new MultiLoader(classLoader); | |||
runtime = createRuntime(resourceLoader, classLoader, runtimeOptions); | |||
|
|||
formatter = runtimeOptions.formatter(classLoader); |
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 don't understand this. Is this needed? This also happens in Runner#buildBackendWorlds which calls runtimeOptions.getPlugins();
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class TestSourcesModel { |
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 don't think TestSourcesModel is part of the public API but I can't tell for sure. Whole thing should probably be package private.
@@ -1,83 +1,99 @@ | |||
package cucumber.runtime.model; |
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.
This package has become quite anemic. All closely tied to RuntimeOptions. Might want to consolidate this, RuntimeOptions and friends into a options package.
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class DataTableDiff extends DataTable { |
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.
This and other classes are all public but don't need to be. They're not part of the public API as far as I can see.
public boolean apply(PickleEvent pickleEvent) { | ||
String picklePath = pickleEvent.uri; | ||
if (!lineFilters.containsKey(picklePath)) { | ||
return true; |
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 think this should be false. If a Pickle isn't referenced in the rerun file it shouldn't be added to the list of pickles to execute.
Unit tests confirm the behavior is as intended, but I can't find any thing to explain this behavior there either.
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 finally remembered why it should be true, see the (new) explaining comment in the test case
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.
That makes sense. The runner presents each file[:line] arguments as having or semantics. But internally it first finds all feature files by looking at the file part and then reduces the set of tests with the line predicate.
Reviewed the [Core] changes Took me a while to do this, this change is somewhat voluminous but I found nothing major. This is mostly a straightforward rewrite against a changed API. There are some TODOs present and a few disabled tests but they don't seem to matter too much. Pushed more more nitpicks to #1122. No point in writing them out. |
@mpkorstanje Your effort is much appreciated. |
I do not know, when I got involved the groupId did correspond to the web site ( |
Amen! 👏 |
|
||
@Override | ||
public void embedding(String mimeType, byte[] data) { | ||
reporter.embedding(mimeType, data); |
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 can not find where this method has been replaced with an event listener. From what I can see this is not needed as the Runtime takes care of this now and will inform the reporter from the pllugins. The TestNgReporter itself prints to sysout and doesn't care about embeddings.
So no problem.
Hey @brasmusson and @mpkorstanje - awesome work on this and sorry it took so long! |
Yes, it is test related, but it is also used in the test of picocontainer. AFAIK it needs to be in the src/main part to be usable from the picocontainer module (on the other hand all of that testing maybe should be moved to the junit module). |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR updates Cucumber-JVM to use the Gherkin v4 parser and compiler.
Notes:
info.cukes
toio.cucumber
, the group id of Cucumber-JVM is also changed toio.cucumber
.Feature: <feature name>
have often been used as "class name", now the feature file path is used instead (as the feature AST is not available after compiling the feature to pickles).Pickle
class in Gherkin does not have a getter for the tags of the pickle, therefore reflection has to be used to access the pickle tags.GherkinDialect
class in Gherkin does not have a getter for each keyword, therefore reflections is used to implement the--i18n
option.All in all, I do not see any blocker for merging this and creating a 2.0.0-SNAPSHOT. Before releasing a 2.0.0 version some more things (
pretty
andhtml
formatters, OSGi support) are needed though.