Functional Automation using Containers (Execution Mode)
In the previous post, we looked at how to run UFT Developer tests using standalone mode. Here, I will explain how to run UFT Developers tests in execution mode. This article is intended for UFT Developer practitioners and automation test engineers, solution architects to understand the working & benefits of UFT Developer using execution mode.
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
Create JAR file
Create JAR file for your test project using maven
mvn clean install
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 execution mode run the below docker cmd
docker run -it -p 5900:5900 --add-host=license-server:<IP address of APLS> -e RUN_MODE=junit -e RUN_CMD="<class name>" -v <path to jar file containing your tests>:<container directory to map tests> -w <working directory> --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>
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 executes the tests in the JAR file that is mapped to container folder on application under test. Tests are executed in the containers and at the end of the execution the container automatically stops. HTML report of the results can be found in the same location as the JAR file in the host machine.
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 !