GitLab Continuous Integration

This support article provides step-by-step instructions to execute Provar test cases in GitLab Continuous Integration using its built-in pipeline.

Continuous Integration (CI) works to integrate code from your team in a shared repository. Developers share their new code in a merge (pull) request, which triggers a pipeline to build, test and validate the new code before merging the changes in your repository.

Continuous Delivery delivers CI validated code to your application.

Git Plugin Information With Provar version 2.2.0 and future releases, you no longer need to install the Git plugin. We’ve packaged this together with our installer files. As a result, the Provar plugin installer will no longer show Git as an option. You can still enable the Jira, TFS and SVN plugins as previously.

Prerequisites in GitLab Continuous Integration

  1. Provar ANT zip file.
  2. Provar project with at least one test case and associated ANT build.xml file.
  3. The Provar project is pushed in Gitlab as a public or private repository.
  4. Provar Execution Only (or Floating) license key pushed into the .license folder of the Github repository. Please only upload license keys on private repositories to avoid unlicensed usage by third parties. Unlicensed access will be tracked and can cause you to be locked out of Provar until a new license key is re-issued to you.

Steps to Create a Project in GitLab

The following steps are completed using free as well as paid GitLab account:

Step 1: Login into your GitLab account.

Step 2: Create a new project and mention project name, description and visibility level.

Sample image in creating a project in GitLab Continuous Integration

Step 3: Take a clone of this new repository into your local machine.

Step 4: Add three folders in this repository:

  • ProvarProject: It contains provar test cases and build.xml file to execute those tests.
  • Provar: It contains .license folder.
  • Provar_Home: This folder is created by extracting Provar_Ant_<Version>.zip file from the latest version of Provar which can be downloaded from the Provar community. This folder contains ant and lib folders.

Step 5: Add .gitlab-ci.yml file in base location of the repository.

Screenshot of folder structure:

Screenshot of GitLab Continuous Integration folder structure

Steps to Create .gitlab-ci.yml File

In order for Gitlab CI to build your project, you will need to add .gitlab-ci.yml configuration file to the root directory of your repository.

If .gitlab-ci.yml  is not in your repository, or is not valid YAML, GitLab CI will ignore it.

Here is an example file:

image: "frekele/ant:1.10.3-jdk8"

  - apt-get update && apt-get install -y xvfb wget -qq
  - java -version
  - ant -version
  - wget -q -O - | apt-key add -
 - echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google.list
 - apt-get update -qq
 - apt-get install -qq google-chrome-stable google-chrome-beta
 - export DISPLAY=:99.0
 - wget -O /etc/init.d/xvfb
 - chmod 0755 /etc/init.d/xvfb
 - sh -e /etc/init.d/xvfb start

   - pwd
   - xvfb-run ant -Dprovar.home=$PROVAR_HOME -Dlicense.path=$LICENSE_PATH -f ProvarProject/ANT/build.xml

Just walking through the example script above:

Firstly, we need to mention the base docker image, as we support Java 8 and test cases execution requires ANT. So, we have taken official image of ant frekele/ant:1.10.3-jdk8.

Describe before_script: 

As we need to execute our UI test cases on a browser, that is why the chrome installation is included. 

To execute test cases in headless manner, we also need to install xvfb, so before executing the actual test script section we are installing xvfb and running xvfb service.

Build step contains variables like PROVAR_HOME and script that is required to execute test cases using command xvfb-run ant -Dprovar.home=$PROVAR_HOME -Dlicense.path=$LICENSE_PATH -f ProvarProject/ANT/build.xml.

Parameter Changes in build.xml

Edit the build.xml file.

  • provar.home: value is ${env.PROVAR_HOME}
  • testproject.home: value is Project name i.e. ProvarProject
  • testproject.results: It’s a result path ProvarProject/Results
  • license.path: It’s a path where .license folder is located. (The path is provided in.gitlab-ci.yml.)

See the Example build.xml

<project default="runtests">
        <property environment="env"/>
        <property name="provar.home" value="${env.PROVAR_HOME}"/>
        <property name="testproject.home" value="ProvarProject"/>
        <property name="testproject.results" value="ProvarProject/Results"/>
        <property name="license.path" value=""/>
        <echo message="provar home is:${provar.home}"/>
        <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-sf.jar"/>
        <taskdef name="Test-Cycle-Report" classname="com.provar.testrunner.ant.TestCycleReportTask" classpath="${provar.home}/ant/ant-provar.jar;${provar.home}/ant/ant-provar-bundled.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}" 
                                webBrowserConfiguration="Full Screen" 
                        <fileset dir="../tests/sample"/>


Trigger the First Build

Once you pushed all changes into GitLab Continuous Integration, it process automatically gets triggered.  

Status of the execution can be checked on CI/CD -> Pipelines.

sample status of the execution can be checked on CI/CD -> Pipelines

Caching in GitLab CI/CD

GitLab CI/CD provides a caching mechanism that can be used to save time when your jobs are running. For more information check this link.

.provarCaches is used to speed up runs of a given job in subsequent pipelines. By including it in the cache, Provar will not download the metadata during each test execution which reduces execution time.

Including the Provar_Home directory in the cache will eliminate the need to download the ANT zip file and unzip it in between  jobs.

image: "frekele/ant:1.10.3-jdk8"
  - wget -q -O - | apt-key add -
  - echo "deb stable main" > /etc/apt/sources.list.d/google.list
  - apt-get update -yqqq
  - apt-get install -qq google-chrome-stable
  - apt-get install -y xvfb -qq
  - if [ ! -d Provar_Home ]; then curl -O && unzip -d Provar_Home; else echo "Found Provar_Home"; fi
    - cd demo/ANT
    - xvfb-run ant -Dprovar.home=$PROVAR_HOME -Dlicense.path=$LICENSE_PATH -f build.xml
      - $PROVAR_HOME/.provarCaches
      - $PROVAR_HOME
      - demo/ANT/Results

Test Results

After successful execution, test reports will be generated in the location mentioned in the build.xml testproject.results parameter. 

<property name=”testproject.results” value=”ProvarProject/Results”/>

Refer to this link for help customizing the reporting options in Provar.

To get reports folder as artifacts in GitLab pipeline, just add below code in your .gitlab-ci.yml file.

     - ProvarProject/Results

Artifacts can be downloaded from the button available on the right side of the below screenshot.  

Artifacts can be downloaded from the button available on the right side of the below screenshot.

In case you don’t want to place Provar_Home in GIT, just add these lines of code in before_script tag

- curl -O
- unzip -o -d Provar_Home
- rm
Review Provar on G2
Documentation library

Other available resources

Looking for something different?

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