Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading