You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is the same issue as #2292 which was closed without a resolution. I have a feature with an ignored scenario that's called by other scenarios in the same feature. Additionally in the Background I call a shared feature with callonce
I would expect when I run the feature, the shared feature is called exactly once. Instead it is called 3 times, once at the start and again each time the ignored scenario is called.
things like callonce make sense when they return data (ideally JSON) that will be cached. try doing * def result = callonce read('shared.feature') and see if that makes a difference
@ignore does not apply when you use call, I thought this was documented somewhere, perhaps it needs to be
In my actual code, Shared Scenario is responsible for setting a cookie which other requests need to authenticate. There isn't really any data returned. I did try karate.callSingle but that doesn't set cookies (or not without some complicated hacking).
Yes, that's what I intended, the whole point is that Generic Scenario is called by other Scenarios but not run otherwise. Shared Feature is also not called from a runner, only used as a helper.
Edit: I tried adding def result = in front and it still runs the shared feature multiple times, I think I tried that in my actual code and in addition to not solving the problem it also didn't set the cookie anymore either
@crazystick until this is fixed (no ETA, PRs welcome) - here's the workaround I suggest. get the data needed for the cookie setting in the callonce or callSingle, then do a normal call and set cookies - which will not be a time-consuming operation at all. this is the pattern most teams use, also see: #2539
I think this is the same issue as #2292 which was closed without a resolution. I have a feature with an ignored scenario that's called by other scenarios in the same feature. Additionally in the Background I call a shared feature with
callonce
I would expect when I run the feature, the shared feature is called exactly once. Instead it is called 3 times, once at the start and again each time the ignored scenario is called.
Runnable project here: https://github.com/crazystick/karate-issue-2292
Main feature:
Shared feature:
Output:
The text was updated successfully, but these errors were encountered: