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

Karate 1.20 move to graalvm breaks usage of variables in multi-value parameters #2226

Closed
LanDinh opened this issue Dec 21, 2022 · 5 comments
Closed
Assignees
Milestone

Comments

@LanDinh
Copy link

LanDinh commented Dec 21, 2022

Code of the type

@name=testScenario
Scenario: example scenario

* def foo = 'foo'
* def bar = 'bar'

* url 'example.com'

Given param test = [#(foo), #(bar)]

fails with the error message

org.graalvm.polyglot.PolyglotException: SyntaxError: Unnamed:1:1 Expected an operand but found error
[#(foo), #(bar)]
 ^

This used to work fine with Nashorn, and using variables in json objects (so using { ... } is still working fine. I don't know if it's an issue with the param keyword, or with the fact that we use [ ... ] here - this is breaking our tests.

@nathanchilton
Copy link

nathanchilton commented Dec 21, 2022

@LanDinh
Enclosing your array in parenthesis should work:

Given param test = ([foo, bar])

This approach is also more concise, since you don't need to use the #() syntax for each variable.

@ptrthomas
Copy link
Member

agree with @nathanchilton

also we recommend that embedded expressions always have string quotes around them. yes the json parser is lenient but it causes trouble like this. the design of embedded expressions is so that JSON remains well-formed: https://github.com/karatelabs/karate#embedded-expressions

@ptrthomas ptrthomas self-assigned this Dec 21, 2022
@ptrthomas ptrthomas added bug and removed invalid labels Dec 21, 2022
@ptrthomas ptrthomas added this to the 1.4.0 milestone Dec 21, 2022
@ptrthomas
Copy link
Member

ignore my above comment, there indeed seems to be a regression in latest versions. @LanDinh do note that we spend a LOT of time creating RC versions, so if you try those earlier and provide feedback, that would save all of us a lot of trouble

@ptrthomas ptrthomas reopened this Dec 21, 2022
@ptrthomas
Copy link
Member

is fixed in develop no ETA for release

@ptrthomas
Copy link
Member

@LanDinh 1.4.0.RC3 has been released, please try it and let us know

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

3 participants