karate icon indicating copy to clipboard operation
karate copied to clipboard

Runner.runFeature returning null causing load test to crash

Open baharford opened this issue 3 years ago • 6 comments

I recently updated the version of karate I'm using from version 1.0.0 to 1.1.0. After upgrading I noticed my gatling load test is crashing. I believe the test is failing due to Runner.runFeature returning a null value.

I have attached a minimal sample project that can be used to reproduce the issue I am seeing.

To reproduce: Unzip attached example project. Verify karate.version in pom.xml has version 1.1.0. Run command mvn test-compile gatling:test in the root of the project

Result: You will see null pointer exception. The result from this code appears to return a null, crashing the test. Map<String,Object> result = Runner.runFeature("classpath:token/GetAuthToken.feature", account, true);

If you revert the karate.version in the pom.xml to 1.0.0 and re-run the command to kick off the test you will see the test runs successfully.

example.zip

baharford avatar Oct 08 '21 14:10 baharford

@ptrthomas @baharford in attached zip, the file GetAuthToken.feature contains @ignore tag on the feature. On removing ignore tag, tests ran fine. https://github.com/karatelabs/karate#special-tags Am I missing something ?

sks1995 avatar Oct 09 '21 17:10 sks1995

yes karate 1.1.0 auto-excludes the @ignore tag: https://github.com/karatelabs/karate#special-tags

maybe this behavior should not apply to Runner.runFeature().

that said - my opinion is Runner.runFeature() is an old API that should not be used in tests, I haven't looked at the code yet, but I'd like to know why a proper gatling karateFeature() can't be used

ptrthomas avatar Oct 09 '21 18:10 ptrthomas

Thanks for the info. It makes sense now why after upgrading to v1.1.0 the Runner.runFeature is returning null. I'll work on updating my gatling simulation to try to use karateFeature()

baharford avatar Oct 11 '21 15:10 baharford

@baharford yes any analysis will help, I'm okay to make the fix to runFeature() - but I'm also keen to make the gatling integration more "usable". do read through this also for reference: https://stackoverflow.com/a/69223217/143475

ptrthomas avatar Oct 11 '21 16:10 ptrthomas

yes karate 1.1.0 auto-excludes the @ignore tag: https://github.com/karatelabs/karate#special-tags

maybe this behavior should not apply to Runner.runFeature().

that said - my opinion is Runner.runFeature() is an old API that should not be used in tests, I haven't looked at the code yet, but I'd like to know why a proper gatling karateFeature() can't be used

I faced the same issue on Java and Karate-core 1.1.0 - The Above comment helps me. Before I had @ignore tag in each feature

anplay avatar Oct 13 '21 10:10 anplay

fixed in develop

ptrthomas avatar Aug 03 '22 07:08 ptrthomas

1.3.0 released

ptrthomas avatar Nov 02 '22 17:11 ptrthomas