Automation in testing up in the cloud
This Summer, I had the pleasure of attending and speaking at the Madrid ExpoQA conference (my 4th time attending). The title of my talk was 'From laptops to lambdas. A test automation journey to the cloud' - a snappy title!
In my talk, I highlighted reasons why it can be difficult to introduce automation in testing, I gave examples of what has worked well and what hasn't when trying to make testing more efficient using automation in testing solutions.
When designing automated checks on a web application we try to follow rules of thumb, one rule is to make sure the automated checks complete within a short period of time, e.g. no more than 2 minutes. The longer the test the more brittle it's likely to be.
Another rule of thumb is to ensure the tests are stand alone, they don't depend on other tests running or completing. This means you can run all the automated checks concurrently, providing quicker feedback on the build quality.
Neil Hayes, a technical tester at Ideagen, has developed and implemented an AWS Lamdba solution running Selenium scripts which suits these two rules to a T. The solution allows running Selenium tests concurrently, as many tests as we have. In this case, one Selenium test is a list of user actions and assertions performed on a web UI. For example, a user logs in to a solution, searches for an item, edits the item, saves and logs out, that would be one Selenium test running on one Lamdba.
If you've not come across it before, AWS Lambda lets you run code without provisioning or managing servers. It’s ideal when you want to run similar pieces of code concurrently, as Lambdas have continuous scaling, and you don't want to worry about the infrastructure.
With Ideagen’s blessing and Neil Hayes' help, I can announce a working example of Selenium running on Lamdbas is available on GitHub as we have recently set it to open source. Neil is currently the only contributor (he did all the hard work, I merely executed the Lambdas!). Now that’s it’s open source, I hope the testing community can make good use of it and contribute to the code.
https://github.com/ideagenplc/Selenium-CSharp-Lambda
A bit of info on the solution:
The solution in Github is using C# and has two options. One option is using one Lambda which executes one Selenium test. The other option requires 2 Lambdas, the first Lambda triggers the 2nd Lambda as many times as required, however many Selenium tests you have designed. The 2nd Lambda can run concurrently, see the simplified diagram below. To get the solution working you will need an AWS account (AWS lets you setup a free account with access to some free infrastructure and solutions) and Visual Studio with the AWS toolkit installed. Note - the solution is using a headless Chrome browser, which isn’t always recommended. Neil has provided links to articles which describe how to run the Lambdas against a full Chrome browser.