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
Testkube BDD Testing TL;DR
TL;DR
Testkube BDD Testing for Distributed Java Applications
1
Testing distributed Java applications is complex - Multiple microservices require comprehensive end-to-end testing to ensure consistency, manage failures, and verify data integrity across all components
2
Cucumber enables BDD testing with natural language - Uses Gherkin syntax to define application behavior in plain English, but faces challenges in Kubernetes environments like test data management and resource configuration
3
Testkube simplifies Kubernetes testing - Provides a unified testing framework built for Kubernetes that can store, execute, and manage tests as Kubernetes CRDs with automated scaling
4
Integration streamlines the workflow - The demo shows creating a Test Workflow using Gradle that integrates Cucumber tests, with real-time logs and automatic artifact collection for test reports
5
Test Workflows consolidate everything - Brings the entire testing process into a single YAML file that manages provisioning, execution, and reporting, making distributed application testing more efficient and manageable
As the trend towards distributed applications continues, testing Java applications has become increasingly complex. Distributed systems involve numerous microservices, making it essential to ensure consistency, manage failures, and verify data integrity across all components. Comprehensive end-to-end testing is crucial to guarantee the application behaves as expected.
Behavior-Driven Development (BDD) addresses these challenges by defining application behavior in natural language, simplifying the explanation and understanding of test cases for distributed applications.
However, integrating BDD into testing distributed Java applications presents its own set of challenges. Maintaining BDD scenarios for multiple services, orchestrating testing environments, and managing services and test data can be daunting tasks.
In this blog post, we will explore how Testkube can streamline BDD testing using Cucumber for distributed Java applications, making the process more efficient and manageable.
Cucumber - BDD Testing Tool for Java
Cucumber is one of the widely used BDD testing tools. It uses Gherkin, which allows teams to define application features using natural language. It includes support for different programming languages, including Java. It also integrates well with popular development frameworks, making it a popular choice. Lastly, it generates detailed reports, giving you insights into testing.
While Cucumber is a great tool for implementing BDD, it has challenges when testing distributed applications, especially in a Kubernetes environment.
Handling test data can be daunting, especially in a distributed environment like Kubernetes. Cucumber requires sharing state and test data between steps, thus ensuring isolation is complex yet critical.
Resources such as compute, memory, and storage are dynamically provisioned in Kubernetes. Cucumber needs access to these resources, and configuring this is difficult.
Aggregating test results from distributed Cucumber test runs are challenging and may require additional setup to bring all of them under one dashboard.
While Kubernetes automates deployments, scaling, and app management, it adds an additional layer of abstraction that needs to be managed along with configuring Cucumber to work with it. This is where a tool like Testkube comes into the picture.
Using Cucumber with Testkube for BDD Testing
Testkube provides a unified testing framework built for Kubernetes to simplify and streamline the entire testing process. The test team can store, execute, and manage tests on Kubernetes clusters. It defines tests as Kubernetes CRDs to provide a modern solution for managing all your tests and scaling when needed.
With Testkube, you can create Test Workflows that include everything from provisioning necessary infrastructure components to integrating seamlessly with other testing tools and orchestrating complex tests. Refer to our Test Workflows documentation to know more.
Let's examine how to use Cucumber with Testkube for BDD testing. We’ll create a Test workflow using Gradle and integrate Cucumber tests into it.
This repo contains all the required files for this example.
Once the prerequisites are in place, you should have a target Kubernetes cluster ready with a Testkube agent configured.
Creating a Test Workflow
Navigate to the Test Workflows tab and click on “Add a new test workflow”
This will provide you with three options:
Create from scratch - use the wizard to create a Test Workflow.
Start from an example - use existing k6, cypress, and playwright examples
Import from yaml - import your own Test Workflow.
We’ll choose the “create from scratch” option to create this workflow.
Provide a name for the workflow and choose the type as Gradle.
Provide the run command. In this case, we’ll provide `gradle test`
Provide a Gradle version, we’ll use `8.5.0-jdk11`
On the next screen, provide the source for the test file. This can either be a Git Repo, String or a file. In this case, we’ll use a Git repo.
On the next screen, it will generate the yaml spec file and display the output.
We will update the yaml by adding `condition: always` in the artifacts steps to ensure that logs are always collected, regardless of whether any step failed.
The yaml file is self-explanatory as it lists down the details you’ve provided in the yaml. Below is the Cucumber feature file that explains what we are testing.
Feature: Hello World
Scenario: Print Hello World
Given I have a working hello world example
When I run the hello world example
Then I should see "Hello World" on the console
The repo contains other files, including test steps and a test runner, which contain related code for executing the Cucumber test.
Click on “Create” to create the test workflow.
Executing the Test Workflow
Once the workflow is ready, you’ll see the newly created test workflow on the screen. Click on it and click “Run Now” to start the workflow.
You’ll see the workflow executing along with the real-time logs of every step.
You’ll see the test result based on the test execution. In this case, we modified the test to fail, and hence, you’ll see the failure.
Since we have configured the artifacts for this, you can navigate to the artifacts tab and look at the reports generated by Cucumber. Testkube saves these reports for every execution, making it easier to analyze the tests.
This was a straightforward demo of creating a Cucumber Test Workflow using Gradle for Kubernetes testing. To take advantage of test workflows more, you can create custom workflows and import them to Testkube.
Summary
This post summarizes the intricacies of running BDD tests for testing distributed Java applications. We looked at Cucumber, a popular BDD testing tool, and the complexities of running it on Kubernetes.
We also looked at Test Workflows, which bring the entire testing workflow into a single file where you can manage all aspects of your testing. The demo showed how to use Cucumber for BDD Testing of Java applications.
Visit the Testkube website to learn more about the other testing tools you can integrate with. If you struggle with anything, feel free to post a note in our active Slack community.
Top 5 Most Important Cucumber BDD Testing with Testkube FAQs
Cucumber BDD Testing with Testkube FAQs
Essential questions about BDD testing in Kubernetes environments
Running BDD tests across multiple microservices introduces complexity in managing shared state, test data, and orchestration. In Kubernetes environments, challenges include dynamic resource allocation, collecting distributed test results, and maintaining environment consistency.
Key challenges include:
State management: Coordinating test data and application state across multiple services and pods
Test orchestration: Ensuring proper execution order and dependencies between distributed test scenarios
Environment consistency: Maintaining stable test environments when containers and resources are dynamically allocated
Result aggregation: Collecting and correlating test results from multiple distributed test runners
Resource contention: Managing CPU and memory resources when running concurrent BDD test suites
Network isolation: Dealing with service mesh policies and network segmentation during testing
These challenges require specialized tooling and orchestration platforms like Testkube to manage effectively at scale.
Testkube enables you to define, orchestrate, and run Cucumber tests as native Kubernetes CRDs. It automates infrastructure provisioning, centralizes test execution and reporting, and provides a consistent way to manage test workflows at scale.
Key simplifications provided by Testkube:
Native Kubernetes integration: Tests are defined as Custom Resource Definitions (CRDs) that integrate seamlessly with your cluster
Automated infrastructure: Automatically provisions test pods, manages resources, and handles cleanup
Centralized orchestration: Single platform to manage all your BDD test workflows and dependencies
Git integration: Pull test scripts directly from your repositories for version-controlled testing
Unified reporting: Consolidates test results, logs, and artifacts in a single dashboard
Workflow automation: Trigger tests automatically based on deployments, schedules, or external events
This eliminates the need for complex custom scripting and manual Kubernetes resource management, allowing teams to focus on writing effective BDD scenarios.
Yes. You can create a Test Workflow in Testkube using Gradle with your Cucumber Java test files. The blog shows how to configure it by pulling test files from a Git repo and executing them using gradle test.
Setting up Gradle-based Cucumber tests in Testkube involves:
Test Workflow configuration: Define a workflow that specifies your Java/Gradle environment and dependencies
Git repository integration: Configure Testkube to pull your test source code from your version control system
Build configuration: Set up the appropriate Gradle commands to compile and execute your Cucumber tests
Configure Gradle wrapper or specific Gradle version
Define necessary JVM parameters and classpath settings
Specify Cucumber runner configuration and test tags
Artifact collection: Configure collection of test reports, screenshots, and other generated artifacts
Environment variables: Pass necessary configuration like database URLs, API endpoints, and credentials
This approach maintains your existing Java/Gradle build process while gaining the benefits of Kubernetes-native test orchestration.
Testkube collects logs and artifacts from each test run, including Cucumber's test reports. These results are stored and accessible via the Testkube UI, helping teams analyze test failures and trends over time.
Comprehensive result management features:
Centralized storage: All test results, logs, and artifacts are automatically collected and stored
Cucumber HTML and JSON reports
Test execution logs and console output
Screenshots and video recordings from failed scenarios
Performance metrics and timing data
Historical analysis: Track test trends, failure patterns, and performance over time
Rich dashboards: Visual representations of test execution status, pass/fail rates, and execution duration
Integration capabilities: Export results to external systems like Slack, JIRA, or monitoring platforms
Filtering and search: Quickly find specific test runs, scenarios, or failure types
Team collaboration: Share test results and insights across development teams with role-based access
This comprehensive approach eliminates the need for custom result aggregation scripts and provides teams with actionable insights for continuous improvement.
No. Testkube abstracts the complexity of Kubernetes setup. Once your cluster has the Testkube agent installed, you can manage all test executions and workflows through the Testkube dashboard or CLI without manually provisioning pods or services.
Testkube handles all Kubernetes complexity automatically:
Resource provisioning: Automatically creates and manages pods, services, and other resources needed for test execution
Lifecycle management: Handles pod startup, execution monitoring, and cleanup after test completion
Resource optimization: Efficiently schedules tests based on cluster capacity and resource availability
Scaling and concurrency: Manages parallel test execution without manual pod orchestration
Storage management: Automatically provisions persistent volumes for test artifacts and results
Network configuration: Sets up appropriate networking for test pods to communicate with target services
What you get with minimal setup:
Declarative test definitions using simple YAML or the web UI
One-click test execution from the dashboard or CLI commands
Automatic integration with your existing CI/CD pipelines
Built-in monitoring and alerting for test execution status
Seamless scaling across multiple clusters and environments
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.