A Complete BDD Workflow with TestRail, Cucumber, and TestRail CLI

A Complete BDD Workflow with TestRail, Cucumber, and TestRail CLI

Behavior-Driven Development (BDD) helps teams align product behavior, testing, and automation around a shared language. Using Gherkin syntax-style, teams can describe how software should behave in a way that is readable by developers, testers, and product stakeholders alike.

However, many BDD workflows are still fragmented. Scenarios are written in one tool, automation lives in another repository, and execution results often remain buried inside CI pipelines.

TestRail now brings these pieces together. With improved BDD support, AI-assisted automation generation, and tight integration with TestRail CLI and Cucumber, teams can manage the entire BDD lifecycle from scenario to execution results.

Writing BDD Scenarios in TestRail

TestRail supports BDD through a dedicated Scenario template that allows teams to write test cases using Gherkin syntax, including familiar keywords such as:

Feature
Scenario
Given
When
Then
And

BDD scenarios now render in TestRail with proper syntax highlighting, including color-coded Gherkin keywords and monospaced formatting. This makes scenarios easier to read, review, and maintain directly inside TestRail.

Teams can create BDD scenarios in two ways:

  1. Manual authoring: Use the Scenario template to write BDD scenarios directly in TestRail using standard Gherkin syntax.
  2. AI-generated scenarios: Generate BDD scenarios using AI from requirements, user stories, or product descriptions. Teams can quickly create an initial set of scenarios and refine them as needed.

Turning BDD Scenarios into Automation with AI

Once scenarios are defined, you can automate them using AI.

With AI Test Script Generation*, automation engineers can convert TestRail test cases into runnable BDD automation scripts in seconds. Instead of manually translating behavior scenarios into code, engineers can generate a working automation starting point and refine it as needed.

It is important to note that TestRail generates the automation code but does not execute the tests. Execution still happens in your automation environment using your existing test framework.

*AI Test Script Generation is part of the TestRail 10.2 update, and will be available in all TestRail instances by mid-April 2026.

Reporting Results with TestRail CLI

Once your BDD tests run, the next step is reporting the results back to TestRail. This is where TestRail CLI comes in.

The TestRail CLI is an open source command line tool that integrates directly with TestRail and allows teams to upload automated test results without writing custom API integrations. 

It works with any automation framework capable of producing JUnit-style XML reports, including frameworks such as JUnit, Pytest, Playwright, Cypress, Cucumber and others. 

Using the CLI, teams can parse their automation reports and automatically create or update test runs in TestRail.

Example:

trcli parse_junit -f results.xml --project "My Project"

This command reads a JUnit XML report and uploads the results to TestRail. The CLI automatically:

  • Parses execution results
  • Creates or updates test runs
  • Maps results to existing test cases

This allows teams to keep manual and automated test results in one place.

Use the Latest TestRail CLI Version

To take advantage of the latest features and improvements, make sure you are using the latest version of the TestRail CLI.

The CLI is open source and available on GitHub:

The repository includes installation instructions, usage examples, and documentation for available commands.

You can install the CLI using pip:

pip install trcli

After installation, the trcli commands can be used locally or inside CI/CD pipelines to automatically upload test results after each test run. For more details, read the TestRail CLI guides or explore the TestRail Academy course.

The CLI is designed to work seamlessly in modern CI environments such as GitHub Actions, GitLab CI, Jenkins, and other pipeline tools.

In This Article:

Start free with TestRail today!

Share this article

Other Blogs

Tracking and Reporting Flaky Tests with TestRail
Agile, Automation, Continuous Delivery, Software Quality

Tracking and Reporting Flaky Tests with TestRail

If you’ve ever dealt with flaky tests, you know how frustrating they can be. These tests seem to fail for no reason—one moment, they’re working perfectly, and the next, they’re not. Flaky tests can undermine your team’s confidence in your test suite and slow e...
Software Testing Life Cycle (STLC): Best Practices for Optimizing Testing
Agile, Automation, Continuous Delivery, Integrations, Software Quality

Software Testing Life Cycle (STLC): Best Practices for Optimizing Testing

Delivering high-quality software becomes challenging when testing lacks structure and detail. Without a clear process, bugs may go undetected until later stages of development—or even after release—leading to higher costs and dissatisfied users. To avoid these...
7 Best Manual Testing Tools for QA Teams
Software Quality, Integrations

16 Best Manual Testing Tools for QA Teams

Even in an era dominated by automation, the manual testing tool remains an essential part of every QA team’s toolkit. While automated tests help scale repetitive tasks, manual testing ensures that the product still meets user expectations, catches edge cases, ...