tracy.z
tracy.z

Reputation: 75

karate: failed to use 'eval' in scenario step

I need to call a .feature file in the scenario but don't care about the result. So I used eval like this:

eval if (gw == 'YES') karate.call('GatewayAuth.feature', authInfo)

But it shows that:

"step 'eval if .....' doesn't have a glue code".

If I use:

def result = (gw == 'YES' ? karate.call('GatewayAuth.feature', authInfo) : null)

the step works fine.

What's wrong with the step use eval?

Upvotes: 3

Views: 587

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Pretty sure you are on an old version of Karate. eval was introduced in 0.7.0

Upvotes: 1

Related Questions