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

Bug: Calling scenario with array argument of different object leads to unwanted behaviour #2543

Open
MRyves opened this issue Apr 3, 2024 · 1 comment

Comments

@MRyves
Copy link

MRyves commented Apr 3, 2024

Hi There!

Example:

Scenario: Foo
    * def arr = [ {foo: 'foo1', bar: 'bar1'}, {foo: 'foo2'}  ]
    * call read('@looping') arr


@looping
Scenario: Loop array
  * print 'foo: ', foo
  * print 'bar: ', bar

Expected output:

foo: foo1
bar: bar1

foo: foo2
bar: null # or error?

Actual output:

foo: foo1
bar: bar1

foo: foo2
bar: bar1

Others opinion on this?

@ptrthomas
Copy link
Member

yes, quite likely bar was set as a "global" variable. it is possible that the use of @setup may work better: https://github.com/karatelabs/karate#setup

tagging this as help wanted - contributions welcome

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