Responsive

Unleashing the Power of CI/CD Testing with Bitbucket

Published
July 20, 2025
Bruno Lopes
Product Leader
Testkube

Table of Contents

Unlock Better Testing Workflows in Kubernetes — Try Testkube for Free

Subscribe to our monthly newsletter to stay up to date with all-things Testkube.

You have successfully subscribed to the Testkube newsletter.
You have successfully subscribed to the Testkube newsletter.
Oops! Something went wrong while submitting the form.
Last updated
July 19, 2025
Bruno Lopes
Product Leader
Testkube
Share on X
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Bitbucket + Testkube Integration TL;DR

TL;DR

Bitbucket Pipelines + Testkube Integration

  • 1
    Automated K8s Testing: Integrate Bitbucket Pipelines with Testkube to automatically deploy and run tests in Kubernetes clusters whenever code changes are pushed or pull requests are created
  • 2
    Simple Setup Process: Create a YAML test workflow (like k6 performance tests), configure a bitbucket-pipelines.yml file, and store your Testkube API credentials as Bitbucket variables for secure access
  • 3
    Seamless CI/CD Integration: The pipeline automatically connects to your Kubernetes cluster, deploys test workflows from your repo, and executes them using the Testkube CLI without manual intervention
  • 4
    Enhanced Code Quality: Every code change triggers automated testing, catching bugs early and ensuring only thoroughly tested code reaches production environments
  • 5
    Comprehensive Monitoring: Track test execution progress, view detailed logs, and collect artifacts through both the Testkube dashboard and Bitbucket's pipeline interface for complete visibility

Various CI/CD tools can facilitate continuous deployment, and Bitbucket is one of them. Combined with Testkube, it offers the ideal way to automate and improve your testing processes.

In this blog post, we'll take a look at how to use Bitbucket Pipelines and Testkube to continuously deploy test cases in the Kubernetes cluster environments as part of the CI/CD pipeline.

What is Bitbucket?

Bitbucket is a code hosting and collaboration tool based on Git that assists development teams in efficiently building, testing, and deploying software. It includes powerful features such as Bitbucket Pipelines, an integrated CI/CD service allowing automated builds, testing, and deployments from within your repositories. Bitbucket simplifies the development lifecycle with its robust integration capabilities and seamless workflow management, making it an ideal choice for teams implementing DevOps practices.

By integrating Bitbucket Pipelines and Testkube, you can utilize test automation and make sure that every change to the code is tested before it goes live, making things faster and more reliable.

Benefits of Using Testkube with CI/CD Pipelines 

The integration of Bitbucket Pipelines and Testkube offers several benefits. Below are listed a few benefits:

  • Automated Testing: Run the tests automatically on every push, lowering the risk of any error.
  • Seamless Integration: Improve the CI/CD workflow by seamlessly integrating the Testkube and Bitbucket pipelines.
  • Improved Code Quality: This integration makes it feasible to identify bugs beforehand, which substantially enhances the quality of the code.
  • Enhanced Security: Testkube ensures that your tests run securely by preventing unnecessary exposure in the CI/CD pipeline, which improves overall system security.

Read more about the benefits of using a tool like Testkube to run your tests from your CI/CD pipeline in the Stop Running Tests with your CI/CD article.

Let’s now understand how to integrate Bitbucket Pipelines with Testkube for a reliable and smooth testing process.

Integrating Bitbucket Pipelines with Testkube

Testkube's integration with any CI/CD tool aims to make the testing process more seamless and efficient. Below is a high-level overview of the actions that we’ll perform:

  • Create a repo with a test workflow file. In this case, we’ll use the k6 test workflow.
  • Configure a pipeline with this repo and trigger it when any new pull request is created.
  • Add our Testkube target cluster’s configuration values in this pipeline.
  • The pipeline then deploys the k6 test to our configured Kubernetes cluster and executes it. 

Prerequisites

Once the prerequisites are met, you should be able to launch a target Kubernetes cluster with a Testkube agent setup and configure a Bitbucket pipeline to deploy and run a k6 test workflow on the target cluster.

To create the API token, refer to our API Token document. To find the Org ID and environment IDs, log in to your Testkube Dashboard and select Settings from the menu bar.

In addition, these IDs and tokens must be stored as variables in Bitbucket to ensure their safe access and use during pipeline execution. For more information, refer to the documentation on Bitbucket variables and secrets

Creating a Test Workflow in Testkube

Testkube Test Workflows are an easy and quick way to define and run tests within a Kubernetes cluster. These YAML-based specifications enable the test to be defined in a single file containing the test, images, artifacts, and resource parameters.

It allows you to create multi-step test workflows that thoroughly manage end-to-end requirements while offering you more freedom and control over the tests.

Discover and learn more about Test Workflows, which enable you to perform efficient and seamless testing in Kubernetes frameworks.

The first step is to create a test workflow. Here's how you can create a test workflow using an example:

  • Login to your Testkube dashboard and navigate to the Test Workflow section.
  • Click the "Add New Test Workflow" button. 
  • A "Create a Test Workflow" dialog box appears, and you can build the sample workflow by selecting the "Start from an Example" option.

Here's a sample Test Workflow I created for k6:

kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
  name: basic-k6-workflow
  namespace: testkube
  labels:
    docs: example
spec:
	content:
  	files:
    - path: /data/example.js
    content: |-
    	import http from 'k6/http';
      import { sleep } from 'k6';
      export default function () {
      http.get('https://test.k6.io');
      sleep(1);
      };   
   steps:
   - name: Run Tests
   workingDir: /data
   run:
   	image: grafana/k6:0.49.0
    env:
    - name: K6_WEB_DASHBOARD
    	value: "true"
    - name: K6_WEB_DASHBOARD_EXPORT
    	value: k6-test-report.html
    args:
    - run
    - example.js
      artifacts:
      	paths:
      	- k6-test-report.html
        status: {}

We’ll save this k6 test workflow configuration as a YAML file in our Bitbucket repository and configure a Bitbucket pipeline.

Configuring Bitbucket Pipelines

Log in to your Bitbucket account and create a repository containing the test workflow file.

Once your repo has been created, go to Repository Settings and enable Pipelines. It will generate a sample bitbucket-pipelines.yml file with some basic configuration. 

We’ll go ahead and configure the pipeline to trigger whenever a new PR is created. 

The file should contain the pipeline configuration, which includes the image to be used, the build steps, and any necessary environment variables or custom configurations.
Let’s look at a bitbucket-pipelines.yml file.

image: kubeshop/testkube-cli

pipelines:
	pull-requests:
    '**':
    	- step:
    		name: Testkube Test
            script:
            	- echo $TESTKUBE_API_TOKEN
            	- testkube set context --api-key                
$TESTKUBE_API_TOKEN --org $TESTKUBE_ORG_ID --env $TESTKUBE_ENV_ID

		# Verify Testkube CLI Installation
        - testkube version
        
        # Run Testkube command to Validate the Connection
        - testkube create testworkflow --name testworkflow-actions -f k6-test-workflow.yaml --update
        - testkube run tw testworkflow-actions

The workflow described above performs the following actions:

  • Sets up a job to connect to the Testkube cloud using the Testkube API key, organization, and environment ID.
  • Creates and runs the k6 test workflow named testworkflow-actions.
  • testkube version: Checks whether the Testkube CLI is properly installed.
  • Runs the test workflow

Note: The --update flag in the run test workflow command ensures that the test workflow is updated with the latest changes and execution history is preserved

Triggering Testkube Test

Make changes to the bitbucket-pipelines.yml file in the repository, and commit the changes by raising a pull request to trigger the pipeline.

Once the pipeline is triggered, Bitbucket Pipelines will execute the test steps specified in the configuration file.

On the Bitbucket interface, click the Pipelines option to view your pipeline's status, detailed information about the log generated during its execution, and other relevant information.

Based on the configuration, we can see that the pipeline triggers with every new PR; it connects to our target Kubernetes cluster, deploys the k6 test from the repo, and executes the test. 

Monitoring the Test Workflow

You can monitor the workflow’s progress and report in the Testkube dashboard or using the Testkube CLI. Let's see how to check the status of the Test Workflow using the dashboard.

  1. Navigate to the Test Workflows tab, where you will see the k6 test workflow named testworkflow-actions that was deployed using the pipeline.
  1. To know more about the status of the test workflow, click on a step.

After the execution, Testkube collects all artifacts, including a stats report with all outputs and results.

The above example demonstrates how simple configuring Testkube with Bitbucket Pipelines is. One can execute advanced scenarios by modifying the workflow and configuring repositories according to their specific requirements.

Summary

We have learned how to set up the Testkube testing workflow with Bitbucket pipelines and how it enhances our testing experience. By integrating the automation capabilities of Bitbucket Pipelines with the testing capabilities of Testkube, you have not only automated the testing process but also created a robust testing framework for the development pipeline. Additionally, this integration not only allows a seamless and efficient testing process but also ensures consistency and reliability in the CI/CD workflows.

So, what are you waiting for? Go one step further and use the collective power of these two to scale your testing processes and deliver reliable releases more quickly. 

Discover how Testkube can transform your testing strategy. oin our Slack community to start a conversation or read Testkube documentation to see how Testkube can enhance your GitOps testing workflow, ensuring seamless, efficient, and automated testing within the Kubernetes environments. The future of software testing is here. Are you ready to be a part of it?

In today's fast-paced world of software development, every build and new feature must be thoroughly tested to ensure a seamless experience and an efficient delivery. Continuous testing enables teams to automate test execution at all stages, detecting issues early and confidently delivering reliable updates. Integrating testing with your CI/CD tools ensures that every code submission triggers the necessary tests, accelerating development while allowing you to focus on other vital tasks.

Top 5 Testkube Bitbucket Pipelines Integration FAQs

Testkube Bitbucket Pipelines Integration FAQs

Essential questions about automating Kubernetes testing with Bitbucket Pipelines

To integrate Bitbucket Pipelines with Testkube for automated Kubernetes testing, follow these steps:

  • Enable Pipelines: Activate Bitbucket Pipelines in your repository settings
  • Configure environment variables: Store your Testkube API Token, Organization ID, and Environment ID as secure Bitbucket variables in your repository settings
  • Create pipeline configuration: Add a bitbucket-pipelines.yml file to your repository root that includes:
    • Setting the Testkube context using your credentials
    • Applying Test Workflow definitions from your repository
    • Executing tests using testkube run tw <workflow-name>
  • Automate execution: Configure triggers to run tests automatically on pull requests or commits to ensure continuous validation

This integration ensures your Kubernetes applications are tested automatically as part of your development workflow, catching issues early in the development cycle.

Before you can run Testkube tests through Bitbucket Pipelines, ensure you have the following prerequisites in place:

  • Bitbucket setup: A Bitbucket account with a repository and Pipelines feature enabled
  • Kubernetes cluster: A running Kubernetes cluster (such as Minikube for local development, or cloud-managed clusters like EKS, GKE, or AKS)
  • Testkube installation: Testkube properly installed in your cluster with the agent running and accessible
  • Authentication credentials: Valid Testkube authentication tokens including:
    • API Token for Testkube access
    • Organization ID for your Testkube organization
    • Environment ID for the target testing environment
  • Test definitions: A defined Test Workflow YAML file in your repository (for example, using k6, Postman collections, or other testing frameworks)

Having these prerequisites ensures a smooth setup and reliable test execution in your CI/CD pipeline.

Integrating Testkube with Bitbucket Pipelines provides several key benefits for your development workflow:

  • Automated test execution: Tests run automatically on every pull request or push, ensuring consistent validation without manual intervention
  • Early bug detection: Catches issues immediately during development, improving overall code quality and development velocity
  • Kubernetes-native testing: Tests run directly in your Kubernetes environment, avoiding the overhead and complexity of traditional CI/CD tool configurations
  • Enhanced observability: Comprehensive monitoring and reporting through:
    • Testkube dashboard for visual test management
    • CLI access for command-line monitoring
    • Detailed execution logs and metrics
  • Secure secrets management: Leverages Bitbucket's built-in environment variables for secure credential handling
  • Scalable testing: Utilizes Kubernetes resources efficiently for parallel and distributed test execution

This combination creates a robust, automated testing framework that scales with your application development needs.

After executing Testkube tests from Bitbucket Pipelines, you have multiple options for monitoring and reviewing test results:

  • Testkube dashboard: Access the web-based dashboard to view test executions under the "Test Workflows" section with detailed metrics, logs, and execution history
  • Bitbucket Pipelines interface: Review test execution logs directly in the Bitbucket Pipelines UI, including build status and detailed step-by-step execution information
  • Testkube CLI monitoring: Use command-line tools for programmatic access:
    • testkube get tw <workflow-name> to view workflow details
    • testkube get execution to list recent test executions
    • testkube get execution <execution-id> for specific execution details
  • Automated reporting: Test reports and artifacts (such as HTML dashboards, screenshots, or performance metrics) are automatically collected and viewable per test step
  • Integration monitoring: Set up alerts and notifications through webhook integrations or monitoring tools for real-time test status updates

This multi-layered monitoring approach ensures you have complete visibility into your test execution and results.

Yes, Bitbucket Pipelines provides flexible conditional triggering options for Testkube test workflows through your bitbucket-pipelines.yml configuration:

  • Pull request triggers: Use pull-requests configuration to execute tests only when pull requests are created or updated
  • Branch-specific triggers: Configure branches patterns to target specific branches like main, develop, or release branches
  • Custom deployment triggers: Leverage Bitbucket's deployment environments and variables for advanced conditional logic
  • Manual triggers: Set up manual pipeline execution for on-demand testing scenarios
  • Scheduled execution: Use Bitbucket's scheduling features for regular regression testing and monitoring
  • File-based conditions: Configure triggers based on file changes in specific directories or with certain extensions

Example conditional configurations include:

  • Running performance tests only on release branches
  • Executing integration tests when API-related files change
  • Triggering smoke tests on every deployment to staging
  • Running comprehensive test suites only on main branch merges

This flexibility allows you to optimize test execution time and resources while maintaining comprehensive coverage aligned with your development and release workflow.

About Testkube

Testkube is a test execution and orchestration framework for Kubernetes that works with any CI/CD system and testing tool you need. It empowers teams to deliver on the promise of agile, efficient, and comprehensive testing programs by leveraging all the capabilities of K8s to eliminate CI/CD bottlenecks, perfecting your testing workflow. Get started with Testkube's free trial today.