How to Automate Functional UI Testing in a DevOps World
Automation is a prerequisite for success with DevOps. Especially test automation is a key ingredient when it comes to providing fast and accurate feedback to testers and developers enabling quick reactions to errors, bugs, and changing requirements.
DevOps—the practice of bridging software development and software operations—is a means to releasing high quality software into production.
DevOps personnel facilitate collaboration and transparency between the different roles involved in the production of software: Development, Testing, and Operations. This includes defining the release pipeline, building or adopting the right tools for the team, and—perhaps most importantly—automating as much of the release pipeline as possible.
The DevOps release pipeline
The backbone of DevOps is the definition of the release pipeline. A release pipeline consists of various phases and checks (gates) that a piece of code or software must pass through as it travels from the individual developer’s computer into production. The pipeline is typically controlled by an “orchestrator” ensuring that things happen in the right order and the right checks are made between phases.
Examples of pipeline orchestrators include Jenkins, Atlassian Bamboo, TFS/VSTO, and TeamCity.
Read: Leapwork Integrations with Pipeline Orchestrators
As illustrated in the figure below, a release pipeline typically includes:
- The individual developer environment where the code is generated
- A build phase where the code is prepared for release using Continuous Integration (CI)
- A testing phase dedicated to various types of testing
- A production environment
To meet the requirements of a Continuous Delivery pipeline, automated functional UI testing is crucial.
Read: How to Achieve Agile Testing by Automating Functional UI Tests
But how do you integrate automated testing in a release pipeline?
A common mistake when implementing automation is to settle for a tool that is not a good fit for the release pipeline. A pipeline should dictate the tool—not the other way around.
How to automate testing across the release pipeline
With the right setup, a test automation platform can be integrated with the release pipeline at several stages serving multiple purposes.
Below are three examples of stages within the release pipeline where you can and should use test automation.
1. Start with your regression testing
This is the primary and most common target for automation; “classic” regression testing in a relatively stable test environment.
Automated regression tests can be triggered from the pipeline orchestrator or simply run on a scheduled basis as needed.
2. Verify your builds
The second area where test automation can support DevOps is to run a small, select set of test cases against CI servers. This will help answer the question: “Is the latest build from the CI servers testable?” In other words, is this build ready to be moved to the Test environment and worth spending actual tester resources on?
This verification exercise provides developers with fast feedback in addition to running unit and integration tests.
3. Implement non-intrusive verification
The third and final application of test automation in the release pipeline is to verify single elements or parts of the software in a Production environment.
The test cases running against Production should be non-intrusive, meaning that they shouldn’t leave any traces or interfere with the main purpose of the software. Instead, this kind of verification is intended for catching issues such as unwanted outages, malfunctions, etc. before users of the software experience them.
These three examples of how to utilize automatedtesting in a DevOps setup is shown in the figure below.
What should DevOps set as criteria for a test automation platform?
From a DevOps perspective, the next step is to look at the requirements for your platform for automation of functional UI tests.
In this respect, there are three things in particular that you should look for:
- Integration: Make sure the platform is easy to integrate with your pipeline. A continuous integration automation tool should come with relevant plugins for the most common pipeline orchestrators and/or well-documented APIs allowing the orchestrator to control the test automation platform.
- Execution time: In a fully automated pipeline, the time needed for running tests is crucial. If it takes 48 hours to run all test cases, the pipeline is dysfunctional and will not work in practice. Make sure that the test automation platform can scale the execution of test cases to keep run-time at a minimum.
- Control and flexibility: Successful automation requires a high degree of flexibility without compromising the feeling of being in control of the pipeline. A test automation platform should make it easy to define and execute different collections of test cases in various environments, for various purposes, and at various times. For example, some environments are more stable than others, allowing for more frequent testing, while other environments are just used for quick verification and feedback.
Leapwork: a test automation platform built for DevOps
The underlying vision of the Leapwork Automation Platform is based on the idea of the DevOps-pipeline.
The Leapwork Automation Platform comes with a comprehensive public REST API allowing third party systems to trigger collections of test cases and retrieve a well-formatted response. Native plugins for the most common pipeline orchestrators (Jenkins, Atlassian Bamboo, TFS/VSTO, TeamCity, and more) are also available for Leapwork.
All of this makes it very easy to include test automation as part of a release pipeline.
Download Whitepaper: DevOps and Test Automation
Do you want to learn more about how to ensure rapid feedback across the CI/CD pipeline through shared automation ownership? Then download the whitepaper: