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:
- Manual authoring: Use the Scenario template to write BDD scenarios directly in TestRail using standard Gherkin syntax.
- 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.




