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

[TestNG] Add CucumberPropertiesProvider #2351

Merged
merged 11 commits into from
Aug 5, 2021

Conversation

GayanSandaruwan
Copy link
Member

#2349
problem
Cannot configure different test suits of same run with different cucumber options.

Describe the solution you have implemented

  1. Supply Custom options to TestNGCucumberRunner.
  2. Read Cucumber Options from testNG.xml

Additional context
See test Execution results.
AbstractTestNGCucumberTests
TestNGCucumberRunner

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.

Looks good!

I've extracted out the properties provider. We just need to sort out the precedence of the different property sources.

@codecov
Copy link

codecov bot commented Aug 4, 2021

Codecov Report

Merging #2351 (f409275) into main (37e5408) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2351      +/-   ##
============================================
+ Coverage     83.36%   83.37%   +0.01%     
- Complexity     2320     2322       +2     
============================================
  Files           300      300              
  Lines          8272     8278       +6     
  Branches        750      750              
============================================
+ Hits           6896     6902       +6     
  Misses         1079     1079              
  Partials        297      297              
Impacted Files Coverage Δ
...ucumber/core/options/CucumberPropertiesParser.java 91.78% <100.00%> (+0.11%) ⬆️
.../java/io/cucumber/testng/TestNGCucumberRunner.java 96.42% <100.00%> (+0.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37e5408...f409275. Read the comment docs.

@mpkorstanje
Copy link
Contributor

Don't worry about the semver chechk failing. That can be solved later.

@GayanSandaruwan
Copy link
Member Author

@mpkorstanje is there anything else I need to do ?

@mpkorstanje
Copy link
Contributor

No looks good. I'm going to have to have a look at the semver problem.

@mpkorstanje mpkorstanje changed the title Passing custom Configurations to TestNGRunner [TestNG] Add CucumberPropertiesProvider Aug 5, 2021
@mpkorstanje mpkorstanje merged commit db3e17b into cucumber:main Aug 5, 2021
@aslakhellesoy
Copy link
Contributor

Hi @GayanSandaruwan,

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 mpkorstanje added this to the v6.x.x milestone Aug 5, 2021
@mpkorstanje
Copy link
Contributor

mpkorstanje commented Aug 5, 2021

All done. Can't use the ITestContext without breaking semantic versioning so that will drop into v7. You'll have to copy the AbstractTestNGCucumberTests and modify the setup step:

    @BeforeClass(alwaysRun = true)
    public void setUpClass(ITestContext context) {
        XmlTest currentXmlTest = context.getCurrentXmlTest();
        CucumberPropertiesProvider properties = currentXmlTest::getParameter;
        testNGCucumberRunner = new TestNGCucumberRunner(this.getClass(), properties);
    }

@GayanSandaruwan
Copy link
Member Author

is there anyway to figure out if this commit has been included in the latest release ?

@mpkorstanje
Copy link
Contributor

You can see the tags that include the commit by clicking on it. Commits are squash merged so you'll want db3e17b

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.

3 participants