I have a feature in which I have several scenarios and each scenario ends with the creation of a user, with userId.
After each scenario, I want to use the
* configure afterScenario = function(){ karate.call('classpath:helpers/DeleteUser.feature')}
so that the user is deleted.
How should I configure the save and where userId after each scenario so that it is universal and that DeleteUser.feature called by afterSceanario can read the userId
I tried to save userId by
- def userId = response.userId
- print ‘Extracted userId: ‘, userId
- karate.write({ userId: userId }, ‘classpath:helpers/variables.json’)
but value is saved in build/src/test/java/helpers/variables.json and when I tried to read that file I have “org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException:”
What is general rule in saving value from 1 feature to another feature? Where it should be stored?
I use gradle in my project