Integrating a testing tool with Bitbucket for the best results

Collaboration between testers and developers is crucial when it comes to releasing a successful product. Both teams should be able to work together, track the changes, and communicate at each stage and level of the process. In order to take care of it, what we can do to make their work the most effective is to provide them with the best tools.

The Atlassian software allows building the consistent software development process in one environment. Products of the Australian company are intuitive, fast-growing, and really flexible which is why they answer the expectations of the majority of enterprises. They are well-known in the industry, which is why they don’t require additional training for the newcomers.

>>Read more about how to implement the new features using only Atlassian products<<

Jira is the most commonly used tool for project management. It’s transparent for developers, testers, managers, marketers, analysts, and all the stakeholders working on a project. Atlassian’s flag product can be extended and enriched by various applications to meet the need of each and every team. For example, Jira extended with a testing tool constitutes a great place to gather all tasks in a single place, from collecting requirements to reporting. It allows all stakeholders to work in a single place and keep on track with all the changes that occur during the complex development process.

But is Jira with a testing tool enough for developers too?

Developers use Jira to plan their tasks, prioritize them, add comments, and get additional data from other teams or customers. However, their actual work needs to be done elsewhere. It needs to be said at the very beginning, that standalone Jira is not a tool made for coding. Just as it’s not made for testing and it needs supplementary functionalities to make it possible for technical teams to perform their work effectively. Testing tools on the other hand don’t focus on the code, their goal is to support tests and tests only. Development teams need more though and for this we recommend Bitbucket.

Testing tool and Bitbucket – the environment that fits all

What is Bitbucket for?

Bitbucket is a code repository hosting server based on Git and made by Atlassian. It’s most often used for code and code review. Bitbucket enables file storage, issue tracking, REST APIs to build third-party integrations, and much more. It provides its users with a familiar interface and the possibility to directly connect Jira Epics, and User Stories to developers’ tasks. It gives the IT team exactly what testing tools give testers – a perfect environment to collaborate. But is it possible to connect all tools: Jira, Bitbucket, and a testing one? Good news – it is.

Requirements and Test Management for Jira

The one thing that you need to achieve in order to connect all equipment is a good testing tool, which also enables third-party integrations. One of them is Requirements and Test Management for Jira (RTM). It’s Hexygen’s testing app, which distinguishes itself from other tools on the Marketplace with its intuitiveness and Jira-based UI. The three apps altogether can create a consistent place for all software development teams. There are a few ways of integrating a testing tool and Bitbucket. Below we will present an eligible scenario of how the process should look like, by sharing the way we’ve integrated Bitbucket during RTM for Jira development.

Before we go further it’s important to remember that during the software development process we benefit from the proper amount of tests of each type:

Source: Spotahome Tech

Integration and Unit tests are more similar to coding and hence they’re close to the development team. E2E tests are written with Test Cafe Framework. Usually, they’re stored separately and sometimes even maintained by different, dedicated teams. Although the pyramid shows that they’re slower and more expensive, they’re as important as the other two. E2E tests help to make sure if basic functionalities of the app work the way they should in the environment used by future customers, so with the web browser.

How to start with automation testing with Bitbucket?

There are 4 options we came up with to start automated testing with Atlassian’s Bitbucket to choose from, depending on the team’s needs and possibilities:

  • – Developer merges code to the main branch manually

  • – Bitbucket Admin runs a manual pipeline

  • – Bitbucket runs tests every day at a previously scheduled time

  • – Starting Test Execution in RTM for Jira testing tool triggers pipeline activation (workflow transition results in activating pipeline on selected branch)

The following steps are similar in each option. After the activation, Bitbucket Pipelines (which is an integrated CI/CD service built into Bitbucket software) builds a version of RTM and installs this version on Heroku. Then, it installs the plugin on Jira testing environment. When it’s done, the pipeline immediately activates automated tests written with frameworks (TestCafe scripts or for example Cypress or Selenium) by creating a dedicated Docker image.

In our scenario, we use Heroku as our Cloud App Platform. In order to make the process work, the first thing that needs to be done is to define a pipeline that will execute the deployment of a given branch of RTM and then will activate test automation sanity. The code in Bitbucket can look as follows:

definitions:
steps:
- step: &e2e-sanity-test
name: Run E2E Sanity Test
script:
- pipe: atlassian/trigger-pipeline:4.3.0
variables:
BITBUCKET_USERNAME: $BITBUCKET_PIPELINE_USER
BITBUCKET_APP_PASSWORD: $BITBUCKET_PIPELINE_PASSWORD
REPOSITORY: 'apps-automated-tests'
BRANCH_NAME: 'develop'
CUSTOM_PIPELINE_NAME: 'rtm-sanity-test'
PIPELINE_VARIABLES: >
[{
"key": "TEST_APP",
"value": "rtm-cloud"
},
{
"key": "SLACK_WEBHOOK",
"value": "TC1971BC6/BLLHDSL1F/bqkv0UHnwGjsPl9vtIubVODT"
}]
pipelines:
custom:
deploy_and_run_e2e_sanity_test:
- step:
size: 2x
name: Deploy to test
caches:
- maven
- npm
script:
- atlas-mvn -B package -Pprod -DskipTests -Dnpm.test.skip -Dnpm.install.skip
- heroku apps:info -a test-rtm-cloud 
- heroku deploy:jar rtm-cloud/target/*.jar --app test-rtm-cloud //deploy to Heroku app "test-rtm-cloud"
artifacts:
- target/*.jar
- step: *e2e-sanity-test

This makes it possible to activate tests from another project with atlassian/trigger-pipeline. As you can see above, to illustrate the example we used a manual (custom) pipeline named deploy_and_run_e2e_sanity_test in our code. This script can run automatically during a merge or be programmed in Bitbucket. The step &e2e-sanity-test will activate another pipeline in the test automation repository: apps-automated-tests. It contains a definition of rtm-sanity-test which in our case is responsible for triggering sanity tests written in Test Cafe for RTM. Here’s how the pipeline looks like:

```aidl
definitions:
services:
docker:
memory: 3072
steps:
- step: &rtm-sanity
name: E2E Sanity Test
image: testcafe/testcafe
script:
- /opt/testcafe/docker/testcafe-docker.sh -e -q -c 2 'chromium:emulation:width=1920;height=1080' tests/cloud/**/*.test.ts --fixture-meta app=$TEST_APP --test-meta scope=sanity -S -s /test-reports -r spec,bitbucket:/test-reports/testcafe-report.xml
after-script:
- pipe: atlassian/slack-notify:0.2.4
variables:
WEBHOOK_URL: 'https://hooks.slack.com/services/${SLACK_WEBHOOK}'
MESSAGE: 'Testy ${TEST_APP} E2E Sanity się zakończyły. Status ${BUILD_STATUS} (${FAILURE_NO})'
services:
- docker
artifacts:
- test-reports/testcafe-report.xml
- test-reports/**

pipelines:
custom:
rtm-sanity-test:
- step: *rtm-sanity

```
`

Pipeline definition for repository with tests definition for RTM

In our scenario, we use the previously mentioned Test Cafe. The framework is extremely helpful when it comes to implementing automated tests and we use it to code the end-to-end automation process. Test Cafe integrates with the most common CI/CD solutions. Most importantly, it supports writing clean, intuitive code.

Test Cafe gives back completed results of testing:

An example of a test run in Test Cafe

In the end, to keep the process consistent pipeline which runs TestCafe tests sends test results as attachments to Requirements and Test Management for Jira app (RTM), sets up Test Execution for the specific Test Plan, and updates its status to Done in the app. Thanks to this, RTM for Jira presents the transparent report from the automated testing process on its built-in tables and charts, understandable for all the stakeholders who take part in the app development.

Test Execution report in RTM for Jira

Summary

It’s also possible to avoid the necessity of installing Bamboo. In this scenario, the Bitbucket pipeline would trigger Test Cafe Runner itself and then, send the test results to RTM for Jira. It all depends on team equipment and individual requirements. In both ways, testing automation with Atlassian tools is shortened and easier for developers and definitely more clear for the teams that are not technical but use Jira for project management.

Do you use Jira and Bitbucket and look for the perfect testing tool to complete the process? Try RTM for Jira for free or set up a Demo if you’ve got any additional questions.

Katarzyna Kornaga

Recent Posts

8 must-have features for quality test cases management

We believe that a functional test management tool should allow you to properly arrange the…

3 years ago

Top 5 software testing trends 2022 – what to expect?

Let’s be honest. All predictions about the future from 2019 until now start from the…

3 years ago

How to improve customer experience with My Requests Extension for Jira Service Management

You probably do not need much convincing that Jira Service Management (JSM) is an awesome…

3 years ago

Building the entire software development process with Atlassian’s suite

The Atlassian toolset makes it possible to perform the whole software development in just one…

3 years ago

Why full traceability of testing objects is so important and how to achieve it

As far as software testing is concerned, traceability is one of the key elements for…

3 years ago

AGH’s Software Quality Engineering faculty migrates to RTM for Jira from TestLink – success case

About AGH University AGH University of Science and Technology is a technical university in Poland,…

3 years ago