How to automate UI testing of an app using a Google login
Demir last edited by
We are using a testing framework composed of robot-framework with ExtendedSelenium2Library that our developers are using to write acceptance tests. Our Web site has several auth options, including direct user/pass but also Google and Twitter OAuth. Devs can run these tests directly on their desktop, and they also get run via our bamboo CI setup locally and using Sauce Labs for crossbrowser.
Our attempts at testing the Google login to the site work OK on the developers' desktops but as they move into CI (elastic bamboo uses on demand instances in AWS, so IPs etc vary), Google starts responding differently with obvious antiautomation responses like this:
The responses start varying and not being consistent. Is anyone else doing webdriver-type automated testing of a site with Google auth, and if so how have you addressed this problem? Are there any google account settings (we're a Google Apps customer), or any ways to pre-set up a profile (any browser is OK) to ensure this functionality would really work for a customer with each build?
We have found that dealing with third party software in CI/dev environments was a great source of intermittency/failure and pain. So in our CI environments, we always create stub services for third parties.
A stub service is basically a fake API service that you control, that behaves the same (or similar) to how the real service does.
I would recommend this method as it provides the following advantages
- Don't have to rely on external service always being up
- Don't receive anything unexpected (like antiautomation responses)
- Have complete control of the stub's responses, so you can test how your service will behave if it receives something strange from the external service.
- Don't have to have external connections to the outside world in your CI environment