I need to call a .feature file from current feature file, and pass a variable from the called .feature file to the caller .feature file. I used karate.set() and karate.get(), but it seems the variable not passed this way. In the called .feature file, I set the variable like "* def token = karate.get('xenpauth')". And in the called .feature file, I try to get the variable like "* def xenptoken1 = karate.get('xenpauth') ". But the xenptoken1 is null. Is the karate objected initialized before every scenario as the karate-config.js?
Asked
Active
Viewed 301 times
1 Answers
0
Yes, each Scenario
is considered "independent" and "stand-alone".
Please read this Stack Overflow answer where this is explained in detail: https://stackoverflow.com/a/49312126/143475
Also read this section of the doc: https://github.com/intuit/karate#script-structure

Peter Thomas
- 54,465
- 21
- 84
- 248
-
@Tanner ah. snark :) IMO this is ok as I added some extra information in this answer. but you spend way more time than me on this site, so "you are the boss" :P – Peter Thomas Mar 28 '18 at 09:23