The scenario looks like this: Assume we have a helloworld.feature file that contains a scenario of just * print "Hello World!"
Then in another feature we do:
Scenario: call karate function from js
* def foo = read('helloworld.feature')
* def bar =
"""
function(){ foo() }
"""
* bar()
# or even * call bar
This will throw an exception. I've also tried karate.get("foo") to get the variable from karate scope and then try to call the result, same issue.
* foo() works fine, however.
Is this possible? Why or why not?
The upswing seems to be that, if you've defined a "feature function" in karate (i.e. using def x = read()), and you want to call the same feature in JS, you have to re-define the function again in JS.