Meet 2025’s Top-rated Software Test Management Tool. Learn More >

How to prioritize test cases in Cucumber?

In this article

To prioritize test cases in Cucumber, you can control the execution order by organizing feature files and scenarios strategically and using tags to define priority levels:

  1. Tag Scenarios by Priority: Assign tags such as @High, @Medium, or @Low to scenarios based on their priority. For example:

gherkin

@High

Scenario: Verify critical functionality

Given …

When …

Then …

  1. Use Tags to Filter Execution: When running tests, use the Cucumber command-line options or configuration file to include or exclude specific tags. For example:

                                                      bash

mvn test -Dcucumber.filter.tags=”@High”

This ensures that high-priority scenarios are executed first.

  1. Order Feature Files and Step Definitions: Organize feature files with high-priority tests in a separate folder and list them first in the test runner or execution pipeline.
  2. Combine with Test Management Tools: If integrated with QA Touch or similar tools, you can assign priorities in the test management system and use the exported data to define your Cucumber execution strategy.

How to run Cucumber scenarios in order?

To run Cucumber scenarios in a specific order, you can use the following approaches:

  1. Order Scenarios in a Single Feature File: Scenarios within a feature file run sequentially, so arrange them in the desired order within the file.
  2. Use Tags to Control Execution: Assign tags to scenarios (e.g., @Priority1, @Priority2) and execute them in the desired order by specifying tags in the runner or command line:

bash

mvn test -Dcucumber.filter.tags=”@Priority1 or @Priority2″

 

  1. Custom Test Runner with Hooks: Use @Before and @After hooks in step definitions to define a specific setup or order of execution logic programmatically.
  2. Control Feature File Execution Order: Organize feature files in directories and use a test runner (e.g., JUnit or TestNG) to define the order of execution. For example:

java

@CucumberOptions(features = {

    “src/test/resources/features/HighPriority.feature”,

    “src/test/resources/features/MediumPriority.feature”

})

 

  1. Use @Order Annotation (if supported): In some testing setups, an @Order annotation can be applied to explicitly define scenario execution order.
  2. Leverage Plugins or Frameworks: Some Cucumber-compatible frameworks or plugins allow test case sorting based on metadata, such as priority or tags.

How does QA Touch enhance the execution of Cucumber scenarios?

QA Touch enhances the execution of Cucumber scenarios in a specific order by providing robust test case management features. You can assign priority levels or tags such as @High, @Medium, and @Low to your test scenarios directly within QA Touch. These tags can then be exported and mapped to your Cucumber feature files, allowing you to control execution order based on priority. QA Touch also supports integration with tools such as Jenkins, enabling automated execution pipelines that can run high-priority scenarios first. With its centralized platform for managing and prioritizing test cases, QA Touch helps the testing process to ensure that critical scenarios are executed in the desired sequence to meet project goals efficiently.

Picture of Sridhar K

Sridhar K

All Posts

Deliver quality software with QA Touch

Questions? Explore our docs, videos, and more just one click away!

Real people with life changing results

Insights from QA Teams on QA Touch’s Impact

Frequently asked questions

Everything you need to know about the product and billing

Why QA Touch?

QA Touch is an AI-driven test management platform built by testers for testers. It simplifies collaboration between developers and QA engineers while helping to manage, track, and organize test cases efficiently. Streamline your testing processes, enhance QA visibility, and deliver high-quality software with ease.

QA Touch offers comprehensive features to manage the entire test management process. From easy migration with CSV files to audio-visual recording of issues and activity logs and a shareable dashboard for real-time reporting to stakeholders, we ensure the testing teams are always on top of things.

Our focus is on providing complete visibility and control over testing workflows and fostering collaboration between testers and other stakeholders (both internal and external). You can have a look at all the features here.

Once you sign up, it takes only 30 minutes to get your QA Touch account up and running. After registration, you will receive an account activation email with all the details. Log in with your account details and create your first test project on QA Touch—it’s that simple. You are now ready to start inviting your team and assigning them roles.

If you are finding it difficult to log in or facing any difficulty, feel free to reach our support team at info@qatouch.com

Why is QA Touch the best test management tool for me?

QA Touch is an AI-driven test management platform that simplifies collaboration between your developers and testers. Beyond creating, organizing, and executing test cases, QA Touch enables you to manage projects, track bugs, and monitor time—all in one platform.

With an intuitive UI and seamless two-way integrations, QA Touch adapts to your workflow, making test management, project oversight, and bug tracking smarter and more efficient.

With secure OKTA, Microsoft Azure SSO, and Google SSO enterprise features, you can stay connected in every app.

We have integrations with dozens of major apps like Slack, Jira, Monday.com, Cypress, and many more. Explore the whole list of integrations now supported here: Explore integrations

The test management tool is a modern software application that helps QA teams and developers manage their testing process efficiently. It provides a structured approach to creating, organizing, executing, and tracking tests to ensure software applications meet specified requirements and function properly before release.

Don’t just take our word for it.

QATouch is a leader in G2 market reports.