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 · 5 comments

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

@ptrthomas ptrthomas added the bug label Aug 6, 2024
@XiangyuTan-learning
Copy link

@ptrthomas HI, I am a master student of software engineering and looking for me first issue to make contribution. Do you mind if I working on this? Any suggestions appreciated!

@ptrthomas
Copy link
Member

@XiangyuTan-learning
Copy link

@ptrthomas Thank you! Do you mind if I ask for some advice about where to start and potential ideas besides the Contributing File. It will help me a lot and I am very appreciate that! thanks

@ptrthomas
Copy link
Member

@XiangyuTan-learning that's really hard to be honest. if you ask a specific question I can try answer when I have time

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