NPE on afterStep because KarateBackend.getVars() seems to return a null?
See original GitHub issueGiven a basic feature file and task runner (below) I’m getting an NPE in the CucumberUtils.afterStep()
due to the KarateBackend returning a null for getVars()
. AFAICT this is not a misconfiguration on my part, but rather a failure of the backend. Please advise.
sanity.feature
Feature: Sanity Check
As a developer
I want to ensure that the test framework is active
So that I can be confident I am testing correctly
Background:
* url httpBin
Scenario: httpBin reflection
Given path '/anything/foo/bar?baz=quux'
When method GET
Then status 200
And match response contains { "args": {"baz":"quux"}}
And match response contains { "method": "GET" }
SmokeTest.java
package apigee.feature.sanity;
import com.intuit.karate.junit4.Karate;
import cucumber.api.CucumberOptions;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
/**
* Created by williamspaul on 8/29/17.
*/
@RunWith(Karate.class)
@CucumberOptions(plugin = {"pretty", "html:target/cucumber"})
public class SmokeTest {
@BeforeClass
public static void beforeClass() {}
@AfterClass
public static void afterClass() {}
}
The Error
java.lang.NullPointerException
at com.intuit.karate.cucumber.CucumberUtils.afterStep(CucumberUtils.java:148)
at com.intuit.karate.cucumber.CucumberUtils.runStep(CucumberUtils.java:140)
at com.intuit.karate.cucumber.KarateRuntime.runStep(KarateRuntime.java:51)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.runBackground(CucumberScenario.java:59)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:42)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102)
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:60)
at com.intuit.karate.junit4.Karate.runChild(Karate.java:25)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at com.intuit.karate.junit4.Karate.run(Karate.java:66)
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:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
NPE on afterStep because KarateBackend.getVars() seems to ...
Given a basic feature file and task runner (below) I'm getting an NPE in the CucumberUtils.afterStep() due to the KarateBackend returning a ......
Read more >NPE when trying to return null - java - Stack Overflow
The compiler picks float because Float can be coerced to float through ... Float toFloat(Float def, String str) { try { return str...
Read more >Tired of Null Pointer Exceptions? Consider Using Java SE 8's ...
A common (bad) practice is to return the null reference to indicate the absence of a sound card. Unfortunately, this means the call...
Read more >Null Pointer Exception In Java - GeeksforGeeks
NullPointerException is thrown when program attempts to use an object reference that has the null value.
Read more >Avoiding the Null Pointer Exception With Optional in Java
The Null Pointer Exception has contributed the most bugs in production ... An empty Optional can be initialized by using Optional.empty() .
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
Verified working with 0.5.0.3
documentation was not being followed closing as invalid.