NPE when first Scenario is Outline in 0.6.2
See original GitHub issueIf the first Scenario when running the entire test suite is a “Scenario Outline”, I get a NPE. If I put a dummy scenario before the outline (or if another feature file runs first), it works fine. This is only affecting 0.6.2 (earlier versions, including 0.6.1, work fine).
Does not work:
Feature: authenticate failure
Background:
* url urlBase
Scenario Outline: authenticate invalid user with missing or wrong credentials
Given path 'auth'
And request { username: '<username>', password: '<password>' }
When method post
Then status 200
And match response contains { user: '#null', token: '#null', error: '#string' }
Examples:
| username | password |
| #(username) | #(password) |
| #(username) | test-wrong-password |
| test-wrong-username | test-wrong-password |
| #(username) | #(password) |
| | |
I get failed tests and this NPE:
java.lang.NullPointerException
at com.intuit.karate.junit4.Karate$1.step(Karate.java:84)
at cucumber.runtime.model.StepContainer.format(StepContainer.java:33)
at cucumber.runtime.model.CucumberScenarioOutline.formatOutlineScenario(CucumberScenarioOutline.java:52)
at cucumber.runtime.junit.ScenarioOutlineRunner.run(ScenarioOutlineRunner.java:52)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
at com.intuit.karate.junit4.Karate.runChild(Karate.java:118)
at com.intuit.karate.junit4.Karate.runChild(Karate.java:33)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at com.intuit.karate.junit4.Karate.run(Karate.java:127)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
However, when I force a simple feature to run before the Outline, it works fine:
Feature: authenticate failure
Background:
* url urlBase
Scenario: dummy scenario before outline
Given path 'missing'
When method get
Then status 404
Scenario Outline: authenticate invalid user with missing or wrong credentials
Given path 'auth'
And request { username: '<username>', password: '<password>' }
When method post
Then status 200
And match response contains { user: '#null', token: '#null', error: '#string' }
Examples:
| username | password |
| #(username) | #(password) |
| #(username) | test-wrong-password |
| test-wrong-username | test-wrong-password |
| #(username) | #(password) |
| | |
I am using IntelliJ with a JUnit run configuration.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
NPE when first Scenario is Outline in 0.6.2 · Issue #282 - GitHub
If I put a dummy scenario before the outline (or if another feature file runs first), it works fine. This is only affecting...
Read more >Java cucumber Selenium : NullPointerException for scenario ...
Note that the exception is recieved only for the first cucumber scenario executed. There is no exception for the second scenario.
Read more >Cucumber and Scenario Outline - Baeldung
Learn how to write Behavioral Driven Development (BDD) unit tests using Cucumber and its concept named Scenario Outline.
Read more >The Book Of Geb
0.6.2. New features; Breaking changes ... The Page Object Pattern is an important technique, and Geb provides first class support via its page...
Read more >Cucumber - Scenario Outline - Tutorialspoint
Scenario outline basically replaces variable/keywords with the value from the table. Each row in the table is considered to be a scenario.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@petercuffari hmm, can you let me know the exact JRE version you are on (output of java -version)
I’ve been trying to track down why this changed from previous versions.
And if you don’t mind can you upgrade your JRE to a version greater than or equal to 1.8.0_112 and that should fix this.
Bingo!
I was on (mac):
I updated to 1.8.0_152 and it works now.
By the way, I really enjoy this project. Thank you for your work! And, my middle name is Thomas 😃