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.
2 Comments