Running Provar on Linux

Introduction

The following page describes how to set up Provar to run tests on Linux and how to troubleshoot common issues with setup. These steps can be applied both to Linux GUI and Linux Server (Non-GUI).

Note that this setup could also be performed on a Windows machine which does not have Provar installed. In this case, however, it is recommended that you just install Provar then follow the steps outlined in the main guide, beginning at Introduction to Test Scheduling.

Note: The following steps have been tested against Ubuntu 16.04. Other Linux versions have not been tested.

Use the following links to navigate to the relevant section:

Generating the Build.xml File

Ensure that you have installed Java 1.8 or later and ANT 1.9.0 or later prior to completing the steps below.

To generate the Build.xml, we recommend using Run Under ANT on a machine which has Provar installed, then customizing the file to run on Linux, as below. Refer to this sample file for an example of a build file configured for use without Provar installed.

The three main property tags that need to be reconfigured are provar.hometestproject.home and testproject.results:

  • provar.home contains the location where the Provar installation was unzipped to. On Windows this defaults to C:\ProgramFiles\Provar
  • testproject.home  is the folder that contains the Test Project .testproject file
  • testproject.results is where the test run’s results should be written

Additional properties:

  • maxMemory defines the maximum memory that the plug-in can use. This is an optional tag and can be excluded if wanted
  •  defines the Run-­Test-­Case  task, together with its classpath
  • The Run­-Test-­Case tag contains execution configuration and runs one or more Test Cases or Test Folders

Note that, while the classpath on  allows different Provar versions to be run on the same machine, ANT always looks in its lib folder first. This means that c lasspath entries will be ignored if the same .jar files exist in the ANT’s lib folder.

Java: Download and Install

Navigate to the folder where you want to download the rpm file (this is the Download folder in our case):

$ cd Downloads/

Download rpm using the following command:

(Note: copy and pasting the below is recommended to avoid errors.)

$ wget –no-check-certificate –no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.rpm

Install Java:

$ rpm -ivh jdk-8u171-linux-x64.rpm

Check Java version and confirm it is installed:

$ java –version

Output:

Note: The steps above were used for java version 1.8.0.171, but these should be same for any other version as well.

ANT: Download and Install

Download and Extract:

$ wget http://www-eu.apache.org/dist//ant/binaries/apache-ant-1.10.3-bin.tar.gz

$ sudo tar xvfvz apache-ant-1.10.3-bin.tar.gz -C /opt

$ sudo ln -s /opt/apache-ant-1.10.3 /opt/ant

Add ANT_HOME to environment variable:

$ sudo sh -c ‘echo ANT_HOME=/opt/ant >> /etc/environment’

Make a symlink:

$ sudo ln -s /opt/ant/bin/ant /usr/bin/ant

Verify the ANT version:

$ ant –version

Output:

Note: The steps above were used for ant version 1.10.3, but these should be the same for any other version as well.

Add Environment variables in Linux: PROVAR_HOME

The following explains how to create the PROVAR_HOME environment variable. This will be the same for any other environment variable on the linux machine.

Edit the .bash_profile file and make the following entry:

PROVAR_HOME = {Path to Provar Home directory}

Commands:

$ cd ~

$ sudo vim /etc/environment

Note: We have used the vim editor, but you can use any editor of your choice.

Create the environment variable PROVAR_HOME, save and close the editor export PROVAR_HOME=/Downloads/ProvarHome

Note: We have extracted my Provar libraries at the location /Downloads/ProvarHome.

Use the following command to load the environment variable:

$ source /etc/environment

Step 2: Add your Provar license to the following location {USERHOME}\Provar\.licenses.

Note: You can generate this license file on the machine where Provar is installed and paste it here.

Step 3: Set up Provar libraries. Create a ProvarHome folder (e.g. /Downloads/ProvarHome) then download and unzip ProvarANT.zip at ProvarHome location. ProvarHome should contain the following folders:

Step 4: Set up your Provar Project: Create a ProvarProject folder (e.g. /Downloads/ProvarProject) then download and unzip Provar Project at ProvarProject location.

Step 5: Trigger the execution by going to the location of build.xml {ProvarProject}\{Project}\ANT and running the following command: ant –f build.xml

You should see execution logs on the terminal. A results file will be created at the location defined in build.xml. (The default location is {ProvarProject}\{Project}\ANT)

Executing Provar Scripts on Linux Server (Non-GUI)

Linux Server is commonly used in test automation for executing test automation scripts since it is cost-effective and efficient in terms of performance.

Advantages:

  • Cost-effective
  • Dedicated to automation (in most cases) so low chances of resource shortage on the machine
  • Better performance

Disadvantages:

  • Difficult to debug the issue in case of failure
  • Time taken to set up the server machine

While it is relatively straightforward to execute the Provar API tests on a Linux Server (Non-GUI) machine, it is more challenging to execute UI tests on these Server machines. To solve this problem, we can create a virtual frame or window that will be used to execute the UI tests.

Note: Setup steps for Linux Server (non-GUI) are the same as mentioned above for Linux GUI.

Xvfb Configuration

There may be many different possible ways to execute the Provar UI scripts on a Non-UI Linux server machine.

The following steps describe how to configure a virtual frame using Xvfb and then trigger the execution.

Step 1: Install xvfb using following command:

$ sudo apt-get install xvfb

Step 2: Navigate to the folder location of build.xml. The default is {Project\ANT\}.

$ cd /{Project\ANT\}/

Step 3: Run the command for ant execution:

$ xvfb-run ant –f build.xml

Execution will start and execution logs can be seen on terminal. Once execution completes, reports will be generated in the normal manner and any email sent to users as configured.

Running Chrome in Headless mode

To run Chrome in headless mode first add an additional Provar environment variable. (This works for both Linux and Windows.)

Values to add:

name:

_chromeOptions

value:

–headless *

*Note that there should be a double hyphen preceding ‘headless’, which may not be rendered properly on this screen. Refer to the screenshots above for an illustration.

Troubleshooting

License details are required. License path: null

Description: The logs show the message “License details are required. License path: null” although the license has already been added to the Build.xml file.

Solution: Try the following:

  • Check entry of Provar License Path in Build.xml file
  • Check License.properties file location and compare path added to build.xml file.
  • Ensure that all cases match: Linux is case sensitive

Error while loading shared libraries: libX.….: cannot open shared object file: No such file or directory

Solution: Try the following:

  • Install package with the following command: sudo apt-get install libxi…. libgconf-2-4
  • Check version of chrome browser: download a compatible chrome driver from here, then unzip and paste into the Project lib folder

[WebDriverException: unknown error: Chrome failed to start: exited abnormally

Description: Console logs show the above error while executing Provar test cases through Jenkins.

Solution: Try the following:

  • Check installed chrome version and compatible chrome driver version
  • Try this solution from StackExchange