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
TestOps with Testkube & GitLab - TL;DR
TL;DR
TestOps with Testkube & GitLab Integration
1
TestOps Integration: Testkube integrates with GitLab to implement continuous testing as part of the DevOps lifecycle, making testing a seamless part of development workflows
2
Automated Test Execution: Every code change or merge request automatically triggers test execution on Kubernetes clusters, ensuring bugs are caught early in the development process
3
Kubernetes-Native Testing: Testkube is designed specifically for Kubernetes environments and can integrate existing testing tools, making them cloud-native and scalable
4
Branch Protection: The integration enables automatic branch protection rules that prevent code merges if tests fail, maintaining code quality and reliability
5
Enhanced Observability: The platform provides detailed logs, artifacts, and visibility into test results throughout the entire testing process, improving debugging and monitoring capabilities
Building an application is no less than painting a masterpiece. Every line of code is like a stroke that completes the painting. However, building the application without testing is like painting in the dark. Nobody knows the outcome. Using traditional testing tools to find bugs is like using flashlights in the dark. They do the job but are inefficient.
This is where continuous testing comes in and makes testing a part of your DevOps cycle - TestOps, as we call it. In this blog post, we’ll explore how Testkube and GitLab can help implement TestOps, ensuring your code evolves into a masterpiece.
TestKube and GitLab For TestOps
GitLab is a popular platform that enables end-to-end DevOps lifecycle management. It provides version management capabilities through Git repositories and helps development, operations, and security teams collaborate. Many organizations rely on GitLab to orchestrate their development workflows.
Testkube, on the other hand, is a testing platform designed for Kubernetes that integrates well with all the popular CI/CD tools, including GitHub Actions and Jenkins, to name a few. It also allows you to plug your existing testing tools and make them Kubernetes.
Testkube and GitLab help you implement TestOps and enable continuous testing as part of your application development lifecycle. Below are some benefits of using Testkube with GitLab:
Unified Testing Ecosystem: Testkube seamlessly integrates with GitLab, providing a unified testing framework. Automating tests and reducing manual intervention creates a streamlined and efficient TestOps workflow.
Continuous Testing: The integration of Testkube with GitLab enables continuous testing throughout your development lifecycle. Every code change triggers test execution, which ensures every change is validated and bugs are identified earlier.
Test Observability: With Testkube integrated with GitLab, you have improved visibility into your tests. From your tests to application logs, Testkube provides detailed logs and artefacts throughout your testing process, giving you better insights.
Integrating Testkube With GitLab
Integrating Testkube with any CI/CD tool aims to enhance your testing process. In this section, we’ll see how to integrate Testkube with GitLab. Below is a high-level overview of the use case:
We will create a repository with a sample k6 test to perform a website load test.
We’ll also configure a Gitlab CI pipeline job, which will be triggered on every new merge request.
The job will create a k6 test on Testkube that is configured on a cluster.
Lastly, we’ll configure a branch protection rule that will not allow a change to be merged if the test fails.
With this high-level overview, let’s see how it works.
The code for this integration is available in this repo. The repo contains a directory named k6, which contains the test. The .gitlab-ci.yml file contains the code for the automated job.
Pre-requisites
GitLab account & repository with GitLab pipeline configured.
Once the prerequisites are in place, you should have a target Kubernetes cluster ready with a Testkube agent configured. You should also have a GitLab repository configured with the test files and the GitLab CI pipeline.
Note: Refer to our API Token document to create the API token. To find the Org ID and environment IDs, log in to your Teskube Cloud dashboard, head to any existing tests page, navigate to CI/CD integration, and choose GitLab. Copy the environment and organization IDs from here.
Pro Tip: You can also use this sample workflow generated by Testkube to create and configure your CI pipeline.
You’ll also need to create variables in GitLab to store these IDs and the token.
K6 Test
We will create a k6 test that performs a load test on the testkube.io website and checks if the response time is less than 1000 milliseconds. If the response is more than that, the test will fail.
import http from'k6/http';
import { check, sleep } from'k6';
exportlet options = {
vus: 1, // Virtual Usersduration: '10s', // Duration of the test};
exportdefaultfunction () {
// Send an HTTP GET request to the websitelet response = http.get('https://testkube.io'); // Replace with your URL
// Check if the response time is less than 1000 milliseconds check(response, {
'Response time is less than 1000 milliseconds': (r) => r.timings.duration < 1000, // Check if response time is less than 1000 milliseconds });
// Add a sleep period (in this case, 1 second) between requests sleep(1);
}
Configuring CI Pipeline Job
We configure the CI pipeline job to execute whenever a new merge request is made. The job uses the Testkube API key, ORG_ID, and ENV_ID which are saved at GitLab variables.
Configures the CI job to connect with Testkube cloud using the Testkube token, organization, and environment ID.
Creates and executes the k6 test using kubeshop/testkube-cli on the EKS cluster.
Based on the result, the status will be updated in the MR. If the test passes, the merge option will be enabled, and anyone can merge it. However, if the test fails, the merge will not be available - we’ll configure an auto-merge protection rule to prevent the PR from being merged if the run fails.
Trigger Testkube Test
To check if everything works correctly, raise a new MR in the repository with some changes. You’ll see that your action is triggered almost immediately.
In the background, our test will run on the target Kubernetes cluster specified. If the test passes, our CI job will update the status in the PR, and a user can merge the PR.
However, if the test fails, the CI job will update the workflow status as failed in the PR. You can see that merging is blocked because of the branch protection rule that we have created, which prevents merging if the test fails.
With this example, we have seen how easy it is to configure Testkube with GitLab. One can perform advanced scenarios by tweaking the workflow and configuring your repositories based on your requirements.
Summary
We looked at the importance of continuous testing and how it enhances our testing. Additionally, we delved into the seamless integration of Testkube with GitLab, a widely used tool for setting up CI/CD workflows. Demonstrating the process, we established a straightforward workflow, successfully incorporating a k6 test using Testkube.
Refer to our documentation for more insights into leveraging Testkube for your CI/CD requirements. Take a proactive step towards implementing TestOps and try Testkube today. Watch this webinar to learn more about how Testkube is suited for TestOps.
Experience the versatility of test types within Testkube, discovering firsthand how its Kubernetes-native capabilities simplify and fortify your testing procedures. For further guidance and assistance, reach out to us on Slack. Happy to help...!
Top 5 Most Important TestOps FAQs
TestOps FAQs
Essential questions about modern testing approaches in DevOps
TestOps is a modern approach to testing that integrates testing deeply into the DevOps lifecycle. Unlike traditional QA, which often happens late in the development cycle, TestOps emphasizes continuous testing, automation, and collaboration across development, operations, and QA teams to ensure faster, higher-quality releases.
Key differences from traditional QA:
Timing: Continuous testing throughout development vs. end-of-cycle testing
Automation: Heavy emphasis on automated testing pipelines vs. manual testing
Collaboration: Cross-functional team integration vs. siloed QA teams
Feedback loops: Immediate feedback on code changes vs. delayed reporting
Infrastructure: Testing infrastructure as code vs. static test environments
Scope: Testing at every stage of deployment vs. pre-production only
TestOps enables teams to detect issues earlier, reduce deployment risks, and maintain higher velocity while ensuring quality.
You can integrate continuous testing by configuring GitLab CI/CD pipelines to automatically trigger tests (e.g. using k6, Postman, or Cypress) through platforms like Testkube. This setup enables every merge request or code push to automatically run tests, and block merging if any fail.
Implementation steps include:
Pipeline configuration: Define test stages in your .gitlab-ci.yml file
Test tool integration: Configure testing tools like k6, Cypress, or Postman to run automatically
Environment setup: Provision test environments dynamically for each pipeline run
Result reporting: Configure test results to be reported back to GitLab for visibility
Failure handling: Set up pipeline rules to stop deployment on test failures
Parallel execution: Run multiple test suites simultaneously to reduce pipeline time
Key benefits:
Immediate feedback on code quality
Prevention of defective code reaching production
Consistent test execution across all environments
Reduced manual testing overhead
Testkube provides a Kubernetes-native testing platform that integrates seamlessly with GitLab CI/CD pipelines, offering several key advantages:
Automated test execution: Trigger tests directly from GitLab pipelines without complex scripting
Simple CLI commands to execute tests
Automatic test discovery and execution
Built-in support for popular testing frameworks
Merge request protection: Block PR merges if tests fail
Automatic status reporting to GitLab
Configurable pass/fail criteria
Integration with GitLab's branch protection rules
Centralized observability: Unified test result management and logging
Dashboard for test execution history
Detailed logs and artifacts storage
Performance metrics and trends
Kubernetes-native execution: Tests run within your cluster environment
Access to internal services and databases
Realistic testing conditions
Scalable test execution
Multi-framework support: Support for k6, Postman, Cypress, JMeter, and more
You can configure branch protection rules in GitLab to require a passing status from a pipeline job (e.g., a Testkube-executed test). If the test fails, GitLab will automatically block the merge until the issue is resolved.
Setup process:
Configure pipeline jobs: Define test execution jobs in your .gitlab-ci.yml
Set job names that will be referenced in protection rules
Configure jobs to fail on test failures
Ensure proper exit codes are returned
Set up branch protection: Navigate to Project Settings → Repository → Protected Branches
Select the branch to protect (usually main/master)
Enable "Allowed to merge" restrictions
Add pipeline success requirements
Configure merge request settings: Require specific pipeline jobs to pass
Enable "Pipelines must succeed" option
Specify required job names or patterns
Configure skipped pipeline handling
Test validation: Verify protection rules work by creating test merge requests
This ensures that no code reaches your protected branches without passing all required tests, maintaining code quality and system stability.
Yes. You can define a GitLab pipeline job that uses the Testkube CLI to create and run a k6 test hosted in your repository. The job will execute the test inside your Kubernetes cluster and report back the result to GitLab, enabling automated performance validations.
Implementation approach:
Test script preparation: Store k6 test scripts in your repository
Create performance test scenarios
Define load patterns and thresholds
Configure test data and parameters
Pipeline configuration: Add k6 test execution to .gitlab-ci.yml
Install and configure Testkube CLI
Create test definitions using testkube create test
Execute tests with testkube run test
Wait for results and handle exit codes
Result handling: Configure comprehensive result management
Collect test artifacts and logs
Parse performance metrics
Generate reports and summaries
Send notifications on threshold breaches
Environment targeting: Test against appropriate environments
Staging environment validation
Production smoke testing
Load testing in dedicated environments
This automation ensures that performance regressions are caught early in the development cycle, maintaining system performance standards.
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.