@karate How to pass parameter to a feature file in gatling simulation class?

Just use the normal Karate concepts such as karate-config.js

You can easily switch environments by setting the karate.env system property.

For example:

mvn test -DargLine="-Dkarate.env=e2e"

EDIT: after you edited your question, it is clear you have a SINGLE flow you want to test. please use a SINGLE feature. I suggest you move the generateAuth into the Background of the feature. Also refer to the docs on callSingle() for advanced options.

If you are expecting 2 feature files to magically share data that is not possible and not needed if you structure your tests correctly.

If you really really need this, please create a Java singleton and access it from each feature. Totally don’t recommend this though.

EDIT: In Karate 0.9.0 onwards, you can call a single scenario within a feature if it has a tag:

classpath:animals/cats/create.feature@sometagname

Leave a Comment