Calling karate.abort() in the Background gives a Nullpointer-exception
See original GitHub issueHi,
Because I don’t want some featuers running on some environments I saw your comment here: https://stackoverflow.com/questions/54308190/karate-how-to-run-a-specific-scenario-only-in-one-environment
So I created this feature-file:
Feature: karate-abort
Background:
* print 'Before the eval'
* eval if (karate.env == 'accp') karate.abort()
* print 'After the eval'
Scenario: test interaction
* print 'In the scenario'
I need to use karate.abort() in the Background, because we’re generating tokens etc. before each scenario which can’t be done on this environment.
But this leads this Nullpointer exception:
java.lang.NullPointerException at com.intuit.karate.core.Step.getDebugInfo(Step.java:46) at com.intuit.karate.core.ScenarioExecutionUnit.execute(ScenarioExecutionUnit.java:202) at com.intuit.karate.core.ScenarioExecutionUnit.run(ScenarioExecutionUnit.java:239) at com.intuit.karate.core.FeatureExecutionUnit.run(FeatureExecutionUnit.java:164) at com.intuit.karate.core.FeatureExecutionUnit.run(FeatureExecutionUnit.java:73) at com.intuit.karate.junit4.Karate.runChild(Karate.java:125) at com.intuit.karate.junit4.Karate.runChild(Karate.java:56) 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.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at com.intuit.karate.junit4.Karate.run(Karate.java:133) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
It looks like that the Nullpointer is only in the getDebugInfo()-method. Is there a workaround to have this behavior without the Nullpointer?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
@gerben86 please use 0.9.5.RC5 I consider it production-ready: https://twitter.com/KarateDSL/status/1203704874619166720
released 0.9.5