Documentation

Looking for something in particular?

Running Provar on Linux

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

Note that this setup can also be performed on a Windows machine that does not have Automation installed. In this case, however, it is recommended that you install Automation and then follow the steps outlined in the leading guide, beginning with Introduction to Test Scheduling.

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

Generating the Build.xml file


Ensure you have installed Java 1.8 and ANT 1.10.9 or later before completing the steps below.

To generate the Build.xml, we recommend using Run Under ANT on a machine with Automation installed and then customizing the file to run on Linux, as below. Refer to the syntax below for an example of a build file configured without Provar installed.

<project default="runtests">
<property environment="env"/>
<property name="provar.home" value="${env.PROVAR_HOME}"/>
<property name="testproject.home" value="<absolute path>"/>
<property name="testproject.results" value="<absolute path>"/>
 
<taskdef name="Provar-Compile" classname="com.provar.testrunner.ant.CompileTask" classpath="${provar.home}/ant/ant-provar.jar"/>
 
<taskdef name="Run-Test-Case" classname="com.provar.testrunner.ant.RunnerTask" classpath="${provar.home}/ant/ant-provar.jar;${provar.home}/ant/ant-provar-bundled.jar;${provar.home}/ant/ant-provar-project.jar;${provar.home}/ant/ant-provar-sf.jar"/>
        
<target name="runtests">
            <Provar-Compile
                   provarHome="${provar.home}"
                   projectPath="${testproject.home}"
                   />
            <Run-Test-Case  
                   provarHome="${provar.home}"
                   projectPath="${testproject.home}"
                   resultsPath="${testproject.results}"
                   testEnvironment="UAT"
                   webBrowserConfiguration="Full Screen"
                   >
                   <pluginProperties plugin="sf" maxMemory="1024"/>
                   <pluginProperties plugin="project" maxMemory="1024"/>
                   <pluginProperties plugin="bundled" maxMemory="1024"/>
                   <fileset dir="${testproject.home}/tests" includes="**/*.*"/>
            </Run-Test-Case>
 </target>
</project>

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. 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.
  •  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 Automation versions to be run on the same machine, ANT always looks in its lib folder first. This means that classpath 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” 

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 will 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.9-bin.tar.gz

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

$ sudo ln -s /opt/apache-ant-1.10.9 /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 used above are for ANT version 1.10.9, but these will be 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.

Step 1: 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 you choose.

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

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

Use the following command to load the environment variable:

$ source /etc/environment

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

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

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

Step 4: Set up your Automation Project: Create a ProvarProject folder (e.g.,/Downloads/ProvarProject) then download and unzip Provar Project at the 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 Automation 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 executing the Automation API tests on a Linux Server (Non-GUI) machine is relatively straightforward, 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 ways to execute the Automation UI scripts on a Non-UI Linux server.

The following steps describe configuring a virtual frame using Xvfb and then triggering 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 the terminal. Once execution is completed, reports will be generated as usual, and any email sent to users as configured.

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 the 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 Automation test cases through Jenkins.

Solution: Try the following:

  • Check the installed Chrome version and compatible Chrome driver version.
  • Try this solution from StackExchange.

Feedback

Was this article helpful for you?
Documentation library

Trying to raise a case with our support team?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top