10

My app contains Sign in from Google function that uses Oauth. To test it I'd want to create test accounts at Google. But Google doesn't allow me to create ordinary accounts without entering captcha so I can't create ordinary accounts for testing.

Can I create test accounts in Google to test Oauth in my application?

0

I usually create a single test account and use it over and over again rather than create a new account each time the test is run. I don't know of any way to create a Google account using automated test scripts.

The alternative would be to build a backdoor into your application login. Something that creates a test account on your site without using Google login that can be used by your test scripts but which is not available to users on your site.

1

Like Stephen Ostermiller suggests you can make a seperate test account. In addition you can change or revoke the app access in your Sign-in & security settings in your desired google account. This is what I use to test different functionality of my Google+ integration. I think that is the most easy option since Google does not have any sandbox accounts as far as I know.

1

You can create a google account and configure a simple project/client within googles cloud console. Then you can configure it for oauth and use googles oauth-playground for creating a refresh-token (which never expires).

With your client-id, client-secret and the refresh-token you can send a post-request in your tests to googles auth-token endpoint (https://www.googleapis.com/oauth2/v4/token) and will receive a valid (short-time) access-token. No manual steps needed here.

I've read about it in this guide.

0

In Google using GMail, you can use dots to make multiple email accounts that all reroute to your main email account. Here are the directions from Google's Help Reference.

https://support.google.com/mail/answer/8158?hl=en

1
  • In my application I just click Sign in from Google button to Sign in like you do to sign in to StackExchange sites. I don't enter email address so I can't make use of your answer Mar 20 '13 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.