Testing using OAuth2 (Google)


#1

Hey there…

…it seems I wiped the issues I was having with prism mocks and now I’m a happy user of mocks and scenarios.

However, I feel I’m missing something during my scenario definition and I’m fully sure this is supported. It’s simply I’m not sure where to start pulling the thread. Hopefully one of nice folks will jump me in…

In my case, I’m trying to model a scenario with authentication. I’ve added an Authentication on type oauth2 for google to simulate our Business Case authentication. We have two scenarios modeled in Gherkin. One of them would be about executing a request on a path without authentication (returning 401) and the other one would be about executing the happy path where the authentication were performed.

I wonder where I could store the bearer obtained from authentication (if I can), or eventually how I could model the call for my scenario to execute authentication in a single step… I’m not sure where I can start. Do you have any whitepaper or something for testing on external authentication providers? I would really appreciate it.

(Testing strategies would be appreciated too… :wink:


(Taylor Barnett) #2

Have you explored using context variables in your Scenarios?

You might be able to save the bearer obtained from authentication and then reuse it in the following steps.