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

Run each Scenario as a TestNG @Test. #1118

Closed
wants to merge 1 commit into from

Conversation

corinned
Copy link

Summary

Currently, cucumber-testng provides the ability to execute each cucumber feature file as one TestNG Test. This fix allows you to run each Scenario as a Test.

Details

AbstractTestNGCucumberTests.class contains a Test method with groups="cucumber-scenarios". The DataProvider for this Test pulls all Scenarios and Scenario Outlines in order to execute each one as its own TestNG test.

A sample implementation of cucumber-scenarios is:

TestNG testNG = new TestNG();
testNG.setGroups("cucumber-scenarios");
testNG.setTestClasses(new Class[]{new AbstractTestNGCucumberTests() {}.getClass()});
testNG.run();

Motivation and Context

#1113

How Has This Been Tested?

Tests added to the existing cucumber.api.testng tests. Additional testing done from a separate java project utilizing the updated library.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@brasmusson
Copy link
Contributor

@corinned I appreciate your effort very much. But ... The reason I don't think this PR should be merged is that it is built on outdated code, that is cucumber.runtime.model.*. With the upgrade of Cucumber-JVM from Gherkin v2.12.2 (see #1035) all of cucumber.runtime.model.* will be removed its functionality replaced by the Gherkin compiler which produces pickles, which are the bases of execution.

The upgrade of Cucumber-JVM from Gherkin v2.12.2 is already long overdue, considering the Cucumber-Ruby was upgraded to a new version of Gherkin in Cucumber-Ruby v2.1.0 - which was release September 11, 2015.

If you would like to implement the feature of this PR on top of #1035, I would be happy to review and work with you on that.

@corinned
Copy link
Author

corinned commented May 1, 2017

Thanks, @brasmusson, I will take a look at #1035.

@prasanta-biswas
Copy link

This will be really useful if we can just run each scenario as a separate Test. Can we do this with current version?

@brasmusson
Copy link
Contributor

@corinned Now that the master branch has been updated to use Gherkin v4, the current implementation of this PR is obsolete, however a re-implementation on the updated master is highly appreciated. Hint: Use Runtime.compileFeature to get the scenarios/pickles to be executed, and execute them like the Android executor does.

@lock
Copy link

lock bot commented Oct 25, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants