Passing parameters while calling a scenario from another feature flie in karate?

Viewed 809

I know how to call specific scenario from another feature file and pass parameters along. But is there a way I can do it while checking for condition using 'if'? For instance:

* if (role=="SME"||role=="BA") karate.call('classpath:rough/utility.feature@checkDisabled'){element: #(elem)}

If this is the wrong implementation as what I get from the console. Please suggest me a way how can i achieve this in karate?

Thanks

1 Answers

When you use karate.call() put the second argument inside the round brackets. This is pure JS and "Karate-style" embedded expressions will not work.

* if (role=="SME"||role=="BA") karate.call('classpath:rough/utility.feature@checkDisabled', {element: elem})

Please take some time to read this part of the docs: https://github.com/karatelabs/karate#call-vs-read

Related