Running cucumber scenarios using TestNG (Scenario level)
See original GitHub issueSummary
When we run the Cucumber-jvm using TestNG, by default it runs each and every feature file as a single Test case. What I want is basically it should give functionality to run each and every scenario with examples as single test case.
Expected Behavior
I want to create screenshots of the test failure and I am currently using selenium with cucumber-testng. Selenium listener is used to capture the event and based on the event it captures the screenshots. But this happens only on a feature level, not at the scenario level. My expectation is I want each scenario to be passed in @Test such that if any scenarios fails. It should trigger the event for test fail such that my code would capture the event.
Current Behavior
It takes all the scenarios as a single test case. So my code is generating the screenshots if any scenarios fails in the feature and a single snap is generated for a particular feature file. It runs the scenarios one after the other and doesn’t trigger any event for the failure.
Possible Solution
By extending the feature of testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
such as
testNGCucumberRunner.runCucumberScenario(cucumberFeature.getFeatureScenario(scenarioname))
Steps to Reproduce (for bugs)
- Functionality for getting all scenarios name and examples
- Adding a method for running cucumber scenario by passing every scenario name
- Throw exception if the scenario name is not present
- Run every scenario as a @Test kind
Context & Motivation
This will help in achieving the scenario level runtime options for the QA for handling events such as creating screenshots or onSuccess things to be done. Feature level Test helps in solving the issues on modular level. But Scenario level test will help in achieving the sub-functionalities and various other uses cases per module.
Your Environment
- Operating System and version: Mac
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
Awesome. Works like a charm now 😃 Thanks I somehow missed the documentation.
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.