1

I need to call a .py file and pass an argument to one of the functions in it and have to match the result returned.

For instance: xyz.py

KarateXyz.feature

  • match result == call('xyz.py')# how to specify the method name and pass an argument in it?
Vinitha Edwin
  • 93
  • 1
  • 11

1 Answers1

1

Yes, you can use karate.exec() to call any OS process. Whether python is installed is up to you. Refer https://github.com/intuit/karate#karate-exec

* def result = karate.exec('python foo.py bar')

For more details, refer: https://stackoverflow.com/a/64352676/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Yes the code works * def result = karate.exec('python xyz.py') but I need to return a list from the method in that .py file when invoked from feature file. How to do that? – Vinitha Edwin Mar 10 '21 at 07:49