Automate user acceptance testing with your DevOps pipeline

Bring your acceptance testing process into your CI/CD pipeline with open source tools.
Register or Login to like
Hand drawing out the word "code"

Acceptance testing, also called user acceptance testing (UAT), determines whether a system satisfies user needs, business requirements, and authorized entity criteria. The tests are repeated every time there's a new design when the application is developed through software development lifecycle (SDLC). In many companies, the Site Reliability Engineer (SRE) automates acceptance testing by building a continuous integration/continuous development (CI/CD) pipeline within a DevOps initiative.

A large number of open source tools are needed to create CI/CD pipelines for both cloud and on-premises infrastructures, so you need to design multiple layers, such as platform, framework, and tools, to achieve productive, effective management of the pipeline.

In this article, I will walk you through a DevOps scenario that integrates automated acceptance testing tools. This example will give you a complete picture of DevOps platform integration.

Build the DevOps platform

How often does an SRE or developer build apps and do acceptance testing? Every single day? Once a week in multiple environments? Previously, you had to install, configure, and manage those environments for each project repeatedly—boring but necessary tasks. However, building a DevOps platform in a Linux container makes it fundamentally easier, quicker, and more secure to do this daily work.

Using enterprise platform-as-a-service (PaaS) solutions based on the Kubernetes project is the most powerful, suitable, and effective way to build the DevOps platform by building source code, packaging container images, and running containers in enterprise production.

To begin this example, use Minishift to create a single-node cluster on OKD (the community distribution of Kubernetes that powers Red Hat OpenShift) locally:

$ brew cask install minishift
$ minishift start --vm-driver virtualbox
$ eval $(minishift oc-env) && eval $(minishift docker-env)
$ oc login $(minishift ip):8443 -u admin -p admin

Deploy the CI framework

Using the container platform, choose one of the popular CI frameworks, such as Jenkins, Travis CI, TeamCity, CircleCI, or Bamboo and deploy it using OpenShift Template, Operator, or Helm Charts. Jenkins is the oldest and most popular open source automation server to set up CI for any programming language environment.

Deploy the containerized Jenkins master server to Minishift via OpenShift Template:

$ oc project at-cicd --> Create an acceptance testing project
$ oc new-app jenkins-ephemeral --> Create a Jenkins Master Server

Integrate acceptance testing tools

Acceptance criteria mostly focuses on application functionalities in the graphical user interface (GUI), which are as known as UI/UX requirements. In this step, developers and the QA team must spend a lot of time validating entire test cases manually, based on the user requirements.

Selenium allows you to automate function tests on webpages using WebDriver scripts that execute test cases interactively, the same way a tester does it manually. To integrate the Selenium tool with the DevOps pipeline on Jenkins, create a Jenkinsfile to define the CI/CD pipeline that includes multiple steps for build, test, and promotion.

Create a similar BuildConfig that contains multiple stages (source clone, build and compile, acceptance test) and run the pipeline resource with Minishift commands:

$ oc create -f at-selenuim-pipeline.yaml --> Create a CI/CD pipeline with AT
$ oc start-build at-selenuim-pipeline --> Start the pipeline

##### Snippet of pipeline buildconfg yaml #####
kind: "BuildConfig"
apiVersion: "v1"
metadata:
  name: "at-selenuim-pipeline"
spec:
  strategy:
    jenkinsPipelineStrategy:
      jenkinsfile: |-
        pipeline {
            agent any
            def mvnHome = tool 'Maven'
            stages {
                stage ('gitclone') {
                    steps {
                        git branch: 'master', url: "Your Code in Git Url"
                    }
                }

                stage ('build') {
                    steps {
                        sh "${mvnHome}/bin/mvn compile"
                    }
                }

                stage ('attest') {
                    steps {
                        sh 'mvn clean test -Dwebdriver.type=remote -Dwebdriver.url=http://localhost:4444/wd/hub -Dwebdriver.cap.browserName=chrome'
                    }
                }
            }
        }
        type: JenkinsPipeline

Conclusion

These practical steps create a shorter path to integrating automated acceptance testing tools in your DevOps platform and accelerating CI/CD capabilities within your team and organization. You can further tune the automation pipeline with other open source testing tools such as JMeter, Maven, and JUnit.

What to read next

6 top continuous integration tools

Continuous integration (CI) is an integral part of an agile software development setup. Sprint after sprint, teams strive to "not break the build" while delivering incremental…

How to run JMeter with Jenkins

Continuous integration is an essential part of the software development lifecycle, and performance monitoring is a key part of continuous integration. We will learn how to set…

Tags
danieloh
Technical Marketing, Developer Advocate, CNCF Ambassador, Public Speaker, Published Author, Quarkus, Red Hat Runtimes

2 Comments

As much as I liked this article, I get hung up on the difference between acceptance tests and user acceptance tests -> I tend to think of these as very different things done by different people. I automate acceptance tests (based on acceptance criteria) but not user acceptance test because the /users/ actually have to acknowledge and provide feedback on if what we built was what they intended.

This is very interesting, Daniel. Thank you for sharing. Selenium has been my go-to tool to facilitate our CI/CD pipeline. We have been leveraging open-source tools and cloud to leverage cloudsourced testing benefits. Although, I have had my share of debates on whether devops and crowdtesting go together or not, I stand by it. What's your take? Does crowdtesting make sense in a DevOps organization? https://www.cigniti.com/blog/crowdsourced-testing-devops/

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.