Bitbucket Pipelines
Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket. It allows you to automatically build, test, and even deploy your code based on a configuration file in your repository. Essentially, containers are created in the cloud. Inside these containers, you can run commands (similar to how you might work on a local machine) but with all the advantages of a new system configured for your needs.
The following includes information about using Automation and Bitbucket Pipelines together.
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
<project default="runtests"> <property environment="env"/> <property name="provar.home" value="${env.PROVAR_HOME}"/> <property name="testproject.home" value=".."/> <property name="testproject.results" value="../ANT/Results"/> <property name="secrets.password" value="${env.PROVARSECRETSPASSWORD}"/> <property name="testenvironment.secretspassword" value="${env.ProvarSecretsPassword_EnvName}"/> <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}" projectPath="${testproject.home}" resultsPath="${testproject.results}" resultsPathDisposition="Increment" testEnvironment="" webBrowser="Chrome_Headless" webBrowserConfiguration="Full Screen" webBrowserProviderName="Desktop" webBrowserDeviceName="Full Screen" excludeCallableTestCases="true" salesforceMetadataCache="Reuse" projectCachePath="../../.provarCaches" testOutputlevel="WARNING" pluginOutputlevel="WARNING" stopTestRunOnError="false" secretsPassword="${secrets.password}" testEnvironmentSecretsPassword="${testenvironment.secretspassword}" invokeTestRunMonitor="true" > <fileset id="testcases" dir="../tests"></fileset> </Run-Test-Case> </target> </project>
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:
image: atlassian/default-image:2 pipelines: default: - step: services: - docker script: - apt-get update && apt install wget unzip xvfb - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list - apt-get update - apt-get install google-chrome-stable -y - export PROVAR_HOME="$BITBUCKET_CLONE_DIR/ProvarHome" - mkdir $BITBUCKET_CLONE_DIR/ProvarHome - curl -O https://download.provartesting.com/latest/Provar_ANT_latest.zip - unzip -o Provar_ANT_latest.zip -d ProvarHome - rm Provar_ANT_latest.zip - cd ${BITBUCKET_CLONE_DIR}/test/ANT - xvfb-run ant -f build.xml artifacts: # defining the artifacts to be passed to each future step. - test/ANT/Results/*
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.
artifacts: # defining the artifacts to be passed to each future step. - test/ANT/Results/*
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:
image: "frekele/ant:1.10.3-jdk8" pipelines: default: - step: name: No parallel tag services: - docker script: - echo "Without parallel Tag" - parallel: - step: name: Parallel 1 services: - docker script: - apt-get update && apt install wget unzip xvfb - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list - apt-get update - apt-get install google-chrome-stable -y - cd test/ANT && xvfb-run ant -f build.xml artifacts: # defining the artifacts to be passed to each future step. - test/ANT/Results/* - step: name: Parallel 2 services: - docker script: - apt-get update && apt install wget unzip xvfb - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list - apt-get update - apt-get install google-chrome-stable -y - cd test/ANT && xvfb-run ant -f build.xml artifacts: # defining the artifacts to be passed to each future step. - test/ANT/Results/*
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.
Executing BitBucket Pipelines using a REST API
You can use webhooks if you would like to execute the pipeline from any external application or release management tool like Copado, Flosum, etc. For more information about incoming webhook requests, please refer to the following:
- Provar Automation
- System Requirements
- Browser and Driver Recommendations
- Installing Provar Automation
- Updating Provar Automation
- Licensing Provar
- Granting Org Permissions to Provar Automation
- Optimizing Org and Connection Metadata Processing in Provar
- Using Provar Automation
- Provar Automation
- Creating a New Test Project
- Import Test Project from a File
- Import Test Project from a Remote Repository
- Import Test Project from Local Repository
- Commit a Local Test Project to Source Control
- API Testing
- Behavior-Driven Development
- Consolidating Multiple Test Execution Reports
- Creating Test Cases
- Custom Table Mapping
- Functions
- Debugging Tests
- Defining a Namespace Prefix on a Connection
- Defining Proxy Settings
- Environment Management
- Exporting Test Cases into a PDF
- Exporting Test Projects
- Japanese Language Support
- Override Auto-Retry for Test Step
- Mapping and Executing the Lightning Article Editor in Provar
- Managing Test Steps
- Namespace Org Testing
- NitroX
- Provar Test Builder
- ProvarDX
- Refresh and Recompile
- Reintroduction of CLI License Check
- Reload Org Cache
- Reporting
- Running Tests
- Searching Provar with Find Usages
- Secrets Management and Encryption
- Setup and Teardown Test Cases
- Tags and Service Level Agreements (SLAs)
- Test Cycles
- Test Data Generation
- Test Plans
- Testing Browser Options
- Tooltip Testing
- Using the Test Palette
- Using Custom APIs
- Callable Tests
- Data-Driven Testing
- Page Objects
- Block Locator Strategies
- Introduction to XPaths
- Creating an XPath
- JavaScript Locator Support
- Label Locator Strategies
- Maintaining Page Objects
- Mapping Non-Salesforce fields
- Page Object Operations
- ProvarX™
- Refresh and Reselect Field Locators in Test Builder
- Using Java Method Annotations for Custom Objects
- Applications Testing
- Provar Manager
- How to Use Provar Manager
- Provar Manager Setup
- Provar Manager Integrations
- Release Management
- Test Management
- Test Operations
- Provar Manager and Provar Automation
- Setting Up a Connection to Provar Manager
- Object Mapping Between Automation and Manager
- How to Upload Test Plans, Test Plan Folders, Test Plan Instances, and Test Cases
- Provar Manager Filters
- Uploading Callable Test Cases in Provar Manager
- Uploading Test Steps in Provar Manager
- How to Know if a File in Automation is Linked in Test Manager
- Test Execution Reporting
- Metadata Coverage with Manager
- Provar Grid
- DevOps
- Introduction to Provar DevOps
- Introduction to Test Scheduling
- Apache Ant
- Configuration for Sending Emails via the Automation Command Line Interface
- Continuous Integration
- AutoRABIT Salesforce DevOps in Provar Test
- Azure DevOps
- Running a Provar CI Task in Azure DevOps Pipelines
- Configuring the Automation secrets password in Microsoft Azure Pipelines
- Parallel Execution in Microsoft Azure Pipelines using Multiple build.xml Files
- Parallel Execution in Microsoft Azure Pipelines using Targets
- Parallel execution in Microsoft Azure Pipelines using Test Plans
- Bitbucket Pipelines
- CircleCI
- Copado
- Docker
- Flosum
- Gearset
- GitHub Actions
- Integrating GitHub Actions CI to Run Automation CI Task
- Remote Trigger in GitHub Actions
- Parameterization using Environment Variables in GitHub Actions
- Parallel Execution in GitHub Actions using Multiple build.xml Files
- Parallel Execution in GitHub Actions using Targets
- Parallel Execution in GitHub Actions using Test Plan
- Parallel Execution in GitHub Actions using Job Matrix
- GitLab Continuous Integration
- Travis CI
- Jenkins
- Execution Environment Security Configuration
- Provar Jenkins Plugin
- Parallel Execution
- Running Provar on Linux
- Reporting
- Salesforce DX
- Git
- Version Control
- Salesforce Testing
- Recommended Practices
- Salesforce Connection Best Practices
- Improve Your Metadata Performance
- Java 21 Upgrade
- Testing Best Practices
- Automation Planning
- Supported Testing Phases
- Provar Naming Standards
- Test Case Design
- Create records via API
- Avoid using static values
- Abort Unused Test Sessions/Runs
- Avoid Metadata performance issues
- Increase auto-retry waits for steps using a global variable
- Create different page objects for different pages
- The Best Ways to Change Callable Test Case Locations
- Working with the .testProject file and .secrets file
- Best practices for the .provarCaches folder
- Best practices for .pageObject files
- Troubleshooting
- How to Use Keytool Command for Importing Certificates
- Installing Provar After Upgrading to macOS Catalina
- Browsers
- Configurations and Permissions
- Connections
- DevOps
- Error Messages
- Provar Manager 3.0 Install Error Resolution
- Provar Manager Test Case Upload Resolution
- Administrator has Blocked Access to Client
- JavascriptException: Javascript Error
- macOS Big Sur Upgrade
- Resolving Failed to Create ChromeDriver Error
- Resolving Jenkins License Missing Error
- Resolving Metadata Timeout Errors
- Test Execution Fails – Firefox Not Installed
- Selenium 4 Upgrade
- Licensing, Installation and Firewalls
- Memory
- Test Builder and Test Cases
- Release Notes