Project : Provar Project with Bitbucket
Configuring Your Provar Project
To set up Bitbucket Pipelines, you must first create and configure the bitbucket-pipelines.yml file in the root directory of your repository.
You also need to configure the Provar project and the other required files to publish it on the Bitbucket repository.
- ProvarProject: It contains the files built in Provar, such as test cases, the src folder, build.xml files, etc.
- Provar License: This includes the .license folder containing execution licenses.
Build.xml Configuration
Edit the below information in the build.xml file.
- provar.home: This value is the path of the ProvarHome folder, which contains the latest ANT libraries
- testproject.home: This value is the Provar project root in your repository
- testproject.results: The Provar results directory in your repository
- license.path: This is the path where the .license folder is located
Creating a Project in Bitbucket
Step 1: Log in to your Bitbucket account.
Step 2: Create a new repository and list the project name, repository name, and visibility level.
Step 3: Push the project configured above to the repository.
Configure your Bitbucket Pipelines
Step 1: Go to Pipelines.
Step 2: Change the template to Other. Now we need to configure the bitbucket-pipelines.yml file.
Here is an example:
Explanation of the Sample Script Above
First, we must mention the base docker image – Provar supports Java version 8, and test case execution requires ANT. So, we have taken the official photo of atlassian/default-image:2. We can also use frekele/ant:1.10.3-jdk8 image, which already has Java 8 and ant.
PROVAR_HOME is the folder’s path containing the latest Provar ANT files. This is referenced in the build.xml provar.home property.
We need to execute our UI test cases on a browser which is why the Chrome installation is included. To execute test cases in headless mode, we also need to install xvfb. Before executing the test script section, install xvfb and run the xvfb service. Execute your test cases using the xvfb-run ant -f build.xml command.
Reports and Artifacts
Step 1: To get the reports folder as artifacts in Bitbucket Pipelines, add the following in bitbucket-pipelines.yml.
Step 2: Now, commit the file. This will create a file named bitbucket-pipelines.yml in your Bitbucket repository.
Step 3: Go to Pipelines. You can see your pipeline running.
Step 4: Click on the Artifacts Tabs. You can download the artifacts here.
Parameterization using Environment Variables
Parameterizations can be used to execute the following:
- Using the secrets and environments password
- Adding data to the build.xml file at run time
To add variables to the repository, follow the below steps:
Step 1: Click the Repository Settings.
Step 2: Add a variable for the secret password. Mark it as secure, which will mask the value.
Step 3: Add a variable for the browser as well. This will help you to define the browser where the execution will be performed.
You can access the variables using the ${env.VARIABLENAME} format in the build.xml file, as shown in the screenshot below.
Parallel Testing
You can achieve parallel testing by configuring parallel steps in Bitbucket Pipelines. Add a set of steps in your bitbucket-pipelines.yml file in the parallel block. These steps will be initiated in parallel by Bitbucket Pipelines so they can run independently and complete faster.
Here is an example:
Job Scheduling
You can schedule your jobs in Bitbucket Pipelines.
Step 1: Go to Pipelines.
Step 2: Click on Schedules.
Step 3: Select your branch, pipeline, and schedule (i.e., Hourly, Weekly, or Daily). This will schedule your run as per the configuration.
Comments
Post a Comment