karatelabs / karate

Test Automation Made Simple

Home Page:https://karatelabs.github.io/karate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

MRyves opened this issue · comments

commented

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?

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