Karate-Netty: Variables defined in calling feature are not present in the called features.
See original GitHub issuekarate-sample-persistent-state-dynamic-scope.zip
Hello! I don’t know if is intended or not, but the dynamic scope in MockServer features doesn’t work, the test fails in the last line of the second proxy.feature
Scenario.
proxy.feature
* def outer_scope_variable = "hello"
* call common_outer_scope ERROR: org.graalvm.polyglot.PolyglotException: ReferenceError: "outer_scope_variable" is not defined
The call to common_outer_scope fails because it can’t find the outer_scope_variable defined anywhere. Also the built-in objects, like request\response are not accessible. This is only for karate-netty, in client features everything works as expected:
first-case.feature:
* def outer_scope_variable = "hello"
# Here the feature just logs the value of the `outer_scope_variable`, to demostrate
# that the problem is only in karate-netty feature files
* call common
I found another bug while investigating this, as you can see in proxy.feature
, to the first call to common_request
is specified an argument.
Scenario: pathMatches('resource')
* match request == body_req
* call common_request ({ test: 1, default_argument: "not default anymore" })
...
In the second call btw, (the second Scenario), the argument is not passed, but the called feature continues to see the old value.
Scenario: pathMatches('resource/bad')
* match request == body_req_2
* call common_request ({ test: 10 })
common-request.feature
* def default_argument = karate.get('default_argument', "default value")
* karate.log("Default Argument: ", default_argument)
EveryTimes it prints:
Default Argument: 'not default anymore'
This can endanger behaviours of feature files which relies upon defaults, making them not trustworthy.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
hi, I had a look yesterday and this project is overly complex
the problem seems to be, on a server side feature, when calling another scenario with no arguments, the called scenario can not see the global variables from calling scenario
Attached is a minimun project that shows this error… karate-mocks-server-calling-other-scenario-error.zip
1.3.0 released