Functional Automation using Containers (Standalone mode)
Container as a technology has matured over the years and mainstream adoption has increased. It is time organizations started to leverage the power of containers in the area of functional test automation as well. I will use UFT Developer container to explain & demonstrate how you can setup and execute your tests using docker container. UFT Developer helps you develop automated tests for a wide range of technologies, using standard IDEs with modern programming languages aligning with shift left approach to test automation.
Prerequisites
- Setup Linux OS in a standalone machine or virtual machine
- Install Intellij
- Install curl – sudo apt install curl
- Install docker
- Install java – sudo apt-get install openjdk-8-jdk
UFT Developer Setup
Pull UFT Developer docker image with chrome browser
You can pull the latest UFT Developer image from docker hub using one of the below commands. UFT Developer offers ready to use docker images with browser preinstalled saving additional step of installing browsers on containers.
//UFT Developer docker image with chrome
docker pull functionaltesting/leanft-chrome
//UFT Developer docker image with firefox
docker pull functionaltesting/leanft-firefox
//UFT Developer docker image without any browser
docker pull functionaltesting/leanft
Pull Autopass License Server (APLS) docker image
Pull latest APLS using below command and apply license OR use existing APLS already in use
docker pull mfsharedtech/apls
Run UFT Dev container
There are 2 modes of executing UFT Developer tests a) Standalone b) Execution. Understand the difference between the modes in the video below or here. To run the UFT Developer container in standalone mode run the below
docker run -it -p 5095:5095 -p 5900:5900 --add-host=license-server:<APLS IP Address> -e LFT_LIC_ID=<License ID from APLS> -e LFT_LIC_ID_VERSION=<License ID Version from APLS> --name=<UFT Developer Container Name> --net <Network Name> functionaltesting/leanft-chrome
Configure Network
This is optional step if you used the –net option in previous step. If not, then you can use below command to configure the network
docker network connect <Network Name> <UFT Developer Container Name>
Configure your test to run the test in the container
Open your UFT Developer test in Intellij and edit the UFT Developer host entry in leanft.properties file to point to UFT Developer container and 5095 port (default port for UFT Developer).
Execution Flow
When we start UFT Developer container, license validation is done with APLS and UFT Developer engine starts running within the container. UFT Developer engine waits to receive the commands and execute the automation steps on application under test. When we execute a test from CLI or IDE, the steps are passed to the UFT Developer engine for execution. After completion of the test, HTML report of the results can be found in the test workspace.
Demo
Benefits
- Automation is resilient to deployment failures
- Tests are running in the background inside the container and not on the host machine where you can continue to work
- Ability to scale test execution
- Reduced and on-demand infra footprint
Leave your comments and feedback !
Excellent work Vijay! Nicely explained.
LikeLike
Excellent work Vijay! Nicely explained.
LikeLike