Skip to content
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

[JUnit Platform] Enable parallel execution of features #2604

Merged
merged 11 commits into from Sep 8, 2022

Conversation

sambathkumar-sekar
Copy link
Member

@sambathkumar-sekar sambathkumar-sekar commented Aug 24, 2022

🤔 What's changed?

New feature as described here -> #2602

Added new configuration constant for conifguration property cucumber.execution.execution-mode.scenario
Added getExecutionModeForScenario() method on CucumberOptions to retrieve the config value
Added overriding getExecutionMethod() for NodeDescriptor & PickleDescriptor to create a execution layer for scenarios
Modified constructor of NodeDescriptor class to accept a new Configuration Parameter argument
Modified createFeatureDescriptor(Feature feature) in FeatureResolver class to include configuration parameters as an argument for NodeDescriptor class

⚡️ What's your motivation?

New Feature -> #2602

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@mpkorstanje
Copy link
Contributor

Reviewing this from my phone I don't see any immediate problems.

It does look like you may have to run mvn spotless:apply on the code though to ensure the formatting is done.

@sambathkumar-sekar
Copy link
Member Author

Thanks for looking into this. I will run 'mvn spotless:apply' and fix the formatting issues.

@sambathkumar-sekar
Copy link
Member Author

@mpkorstanje I have applied the formatting changes using spotless and pushed those changes

@codecov
Copy link

codecov bot commented Sep 5, 2022

Codecov Report

Merging #2604 (8d2a914) into main (c22dce5) will increase coverage by 0.02%.
The diff coverage is 92.00%.

❗ Current head 8d2a914 differs from pull request most recent head 019f8b1. Consider uploading reports for the commit 019f8b1 to get more accurate results

@@             Coverage Diff              @@
##               main    #2604      +/-   ##
============================================
+ Coverage     84.66%   84.68%   +0.02%     
+ Complexity     2710     2696      -14     
============================================
  Files           321      320       -1     
  Lines          9499     9516      +17     
  Branches        906      908       +2     
============================================
+ Hits           8042     8059      +17     
- Misses         1126     1127       +1     
+ Partials        331      330       -1     
Impacted Files Coverage Δ
...r/junit/platform/engine/CucumberEngineOptions.java 91.89% <0.00%> (-5.26%) ⬇️
...nit/platform/engine/DiscoverySelectorResolver.java 95.74% <ø> (ø)
...cucumber/junit/platform/engine/NodeDescriptor.java 97.14% <97.05%> (-2.86%) ⬇️
...ucumber/junit/platform/engine/FeatureResolver.java 100.00% <100.00%> (ø)
...unit/platform/engine/CucumberEngineDescriptor.java 100.00% <0.00%> (+14.81%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've (finally) been able to review this on my PC. Thanks for waiting!

It looks like there is some test coverage missing. Consider adding a test to FeatureResolverTest that tests a feature with a Feature -> Rule -> Scenario Outline -> Examples -> Example in it to verify that all the nodes have the SAME_THREAD option.

The documentation also seems to be a bit hesitant in mentioning that this restores the JUnit 4 behaviour of executing all scenarios in a feature on the same thread. Consider rewriting the documentation to make this more clear.

Finally please up the CHANGELOG.md file.

cucumber-junit-platform-engine/README.md Outdated Show resolved Hide resolved
cucumber-junit-platform-engine/README.md Outdated Show resolved Hide resolved
cucumber-junit-platform-engine/README.md Outdated Show resolved Hide resolved
cucumber-junit-platform-engine/README.md Outdated Show resolved Hide resolved
cucumber-junit-platform-engine/README.md Outdated Show resolved Hide resolved
@mpkorstanje
Copy link
Contributor

Owh and feel free to ignore the failures from the semver check. I'll fix those prior to merging.

…E to PARALLEL_EXECUTION_MODE_FEATURE_PROPERTY_NAME

* added additional tests to cover changes made in NodeDescriptor and PickleDescriptor

* modified README.md with proper phrases and introduced references to Junit4 behaviour

* added an entry in the CHANGELOG.md
@sambathkumar-sekar
Copy link
Member Author

@mpkorstanje I have pushed the changes now. Thanks again 👍

@mpkorstanje mpkorstanje changed the title changes for sequential scenario run on parallel context [JUnit Platform] Enable parallel execution of features Sep 8, 2022
@mpkorstanje mpkorstanje merged commit 627ffa1 into cucumber:main Sep 8, 2022
@aslakhellesoy
Copy link
Contributor

Hi @sambathkumar-sekar,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@mpkorstanje
Copy link
Contributor

Cheers!

@sambathkumar-sekar
Copy link
Member Author

Thanks a lot @mpkorstanje for guiding me to add this and taking your time to refactor the commits. Cheers!

@ch-akash
Copy link

How is this implemented? There is no documentation I am able to find. I am chasing same problem - want to run scenario in sequence but feature in parallel.

@mpkorstanje
Copy link
Contributor

@ch-akash the documentation was updated as part of this PR. If you look at the changes in the PR, I'm sure you'll be able to find the documentation.

@ch-akash
Copy link

I saw the readme file, checked on Cucumber's official documentation for parallel execution and even in this PR I did not find the solution as in how is it achieved and what are the steps to be taken. I checked this PR but it has no 'Steps to do' or migration guide. As far as I checked. Any direct link to this documentation? The checklist says doc updated but where is it?

@sambathkumar-sekar
Copy link
Member Author

@ch-akash if you have really gone through the PR you might’ve found the solution. You need to use the Junit5 property cucumber.execution.execution-mode.feature to achieve your desired execution. and this solution is only for cucumber7 with Junit platform. Behaviour of this property is explained in Readme file of cucumber-junit-platform-engine project.

@mpkorstanje
Copy link
Contributor

@ch-akash This is an opensource project that mostly runs on peoples spare time. Unfortunately writing detailed migration guides and step by step tutorials is a time consuming effort.

However if you read the JUnit Platform README and the JUnit 5 documentation from top to bottom all the information you need should be there. If this is too much at once consider looking for a JUnit 5 tutorial first before moving into the JUnit 5 and Cucumber documentation.

@ch-akash
Copy link

Many thanks @mpkorstanje and @sambathkumar-sekar for replying. I respect the time you gave to my comment. I will try it and will go through the documentation first if I have doubts.

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants