Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable reference lost after calling a scenario in separate feature #2527

Open
cl-weclapp opened this issue Mar 8, 2024 · 3 comments
Open

Comments

@cl-weclapp
Copy link

Since the update from 1.3.1 to 1.4.1, we have had the problem that variables "lose" their reference after a scenario is called in another feature.

The following simplified example code shows the problem:

Feature: references test

  Scenario: references scenario
* def nestedJson = { value: 1 }
# Changing the value works:
* set nestedJson.value = 2
And match nestedJson == { value: 2 }

* def containingJson = { nested: "#(nestedJson)" }
# Changing the value is reflected in the containing element:
* set nestedJson.value = 3
And match containingJson.nested == { value: 3 }

* call read("./callEmptyFeature.feature")
# Changing the value is still reflected in the containing element:
* set nestedJson.value = 4
And match containingJson.nested == { value: 4 }

* call read("./callEmptyScenario.feature")
# Changing the value is no longer reflected in the containing element:
* set nestedJson.value = 5
And match containingJson.nested == { value: 5 }
# -> fails, the value is still 4

Thanks in advance for a fix.

@ptrthomas
Copy link
Member

possibly related to #2502 - tagging as help wanted

@ptrthomas
Copy link
Member

@cl-weclapp if you submit a working example as per this process that will help: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue

@cl-weclapp
Copy link
Author

@ptrthomas Sure, no problem

karate-reference-test.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants