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 use karate-config.js for retrieving access tokens for testing an API. I have an authentication.feature file with two scenarios, one for getting a token with a username and password, one for getting a token with a client ID and secret. I used tags @password and @client on each scenario respectively. Now, I also need to obtain tokens for several users and clients so I would need to use cache keys as explained here, so authentication.feature would be called once per user/client.
It seems I can't get the tag selector and the cache key to work together. I could not find in which order they are supposed to be used, if it's even possible. Here's what I tried:
karate.callSingle('classpath:authentication.feature@password?' + username, {...}): always returns an empty object.
karate.callSingle('classpath:authentication.feature?' + username + '@password', {...}): runs both scenarios when I wanted only the password scenario.
For reference, here is the normal behavior when using only one, although it doesn't fit with my use case: karate.callSingle('classpath:authentication.feature@password', {...}): runs only the password scenario but only for the first user, then the same token is returned because of the cache.
karate.callSingle('classpath:authentication.feature?' + username, {...}): runs both scenarios for every user/client.
Thanks for any help!
The text was updated successfully, but these errors were encountered:
I use karate-config.js for retrieving access tokens for testing an API. I have an authentication.feature file with two scenarios, one for getting a token with a username and password, one for getting a token with a client ID and secret. I used tags
@password
and@client
on each scenario respectively. Now, I also need to obtain tokens for several users and clients so I would need to use cache keys as explained here, so authentication.feature would be called once per user/client.It seems I can't get the tag selector and the cache key to work together. I could not find in which order they are supposed to be used, if it's even possible. Here's what I tried:
karate.callSingle('classpath:authentication.feature@password?' + username, {...})
: always returns an empty object.karate.callSingle('classpath:authentication.feature?' + username + '@password', {...})
: runs both scenarios when I wanted only the password scenario.For reference, here is the normal behavior when using only one, although it doesn't fit with my use case:
karate.callSingle('classpath:authentication.feature@password', {...})
: runs only the password scenario but only for the first user, then the same token is returned because of the cache.karate.callSingle('classpath:authentication.feature?' + username, {...})
: runs both scenarios for every user/client.Thanks for any help!
The text was updated successfully, but these errors were encountered: