Home > OS >  How to get a particular value when using karate.fork?
How to get a particular value when using karate.fork?

Time:02-03

When we use karate.fork for CLI command and need some information from there to be stored in a variable and using it in the next step.

for EX - karate.fork('java -version')

We need to get only the version data alone.

CodePudding user response:

Then karate.fork() is the wrong choice - just use karate.exec() instead. It does the same thing, but will block, and also return the console output:

* def output = karate.exec('java -version')

Please read this also for advanced examples: https://stackoverflow.com/a/62911366/143475

  •  Tags:  
  • Related