Scenario Editing

This section guides you on how to edit scenarios in CukeTest's feature files using Visual Mode. Before we begin, let's briefly understand what a "Scenario" is.

What is a Scenario?

In a feature file, a Scenario describes a specific story of what a user wants to accomplish, which is essentially a test case. Examples include "User successfully logs into the system" or "Add a product to the shopping cart."

A feature file consists of multiple such scenarios. In CukeTest's Visual Mode, scenarios are displayed as collapsible panels or hierarchical trees, making them very easy to manage.

Three Types of Scenarios

In practice, not all scenarios are simple linear sequences. Depending on their purpose, scenarios are divided into three types. Understanding the differences between them is crucial:

Type What is it / When to use Features
Scenario Ordinary test cases. Describes one-time, linear action flows. Most common; the majority of a feature file consists of ordinary scenarios.
Scenario Outline Templates with parameters. Use this when you need to run the same operation many times with different data (e.g., testing with 5 different sets of login credentials). Must be used with a data table called Examples. The engine automatically reads the table row by row, replaces variables in the scenario, and executes them repeatedly.
Background Common prerequisites. Use this when all scenarios in the feature file share the same opening actions (e.g., every scenario must open the browser and log in first). A feature file can have only one Background, and it must be placed at the very top of all scenarios. Background steps are executed once before running any scenario.

1. Adding and Inserting Scenarios

To add a scenario to a feature file, you can use the following two operations:

1.1 Appending a New Scenario at the End

Scroll to the very bottom of the feature file and click the Add new scenario button.

  • Expected Result: The system will automatically append a new blank scenario template at the very end of the document. This is the most common and fastest way.

1.2 Inserting a Scenario at a Specific Position

If you want to "cut in line" between specific scenarios:

  1. Right-click the title bar of an existing scenario.
  2. From the context menu, select Insert Scenario.
  3. A new blank scenario will be inserted before the scenario you right-clicked.

Note

Note: Since the "Background" must be fixed at the top of the entire feature file (before all regular scenarios), you cannot insert a new scenario above the "Background."

2. Editing Basic Scenario Information

All scenarios require clear identification and description, which can be done by double-clicking or through the right-click menu.

2.1 Modifying the Scenario Title

  • Operation: Directly double-click the existing scenario title text.
  • Expected Result: The title becomes an editable input box. Press Enter to save after typing. A clear title (e.g., "Login fails with invalid password") significantly improves readability.

2.2 Adding/Editing a Description

  • Operation: Right-click the scenario title bar and select Edit Description.
  • Expected Result: A multi-line text area expands where you can add detailed background information, such as the context of the test case or pre-test requirements.

2.3 Managing Tags

Tags are special markers starting with @ (e.g., @smoke, @regression) used to classify scenarios. When running a project, they help you quickly filter and execute only the test cases with specific tags.

  • Operation: Right-click the scenario title bar and select Edit Tags.
  • Expected Result: A tag input box pops up. You can enter multiple tags to use as filtering criteria later.

3. Converting Scenario Types

If you initially wrote an ordinary scenario and later realize it needs to be an "Scenario Outline" with parameters, you can convert it using these steps.

Instructions:

  1. Right-click the title of the scenario you want to convert.
  2. Hover over Change Scenario Type in the menu and select the target type (e.g., Scenario Outline).

Conversion Behavior and Expected Results:

  • Scenario -> Scenario Outline: CukeTest intelligently scans the variables in the steps of that scenario and automatically generates an Examples table with these variable names as headers.
  • Scenario -> Background: Since there can only be one Background and it must be at the top, the scenario will be automatically moved to the very top of the document after conversion. This conversion is only allowed if no Background currently exists in the document.
  • Scenario Outline -> Background: Direct conversion is not supported. You must first revert it to an ordinary Scenario before converting it to a Background (and original table data will be lost, so proceed with caution).

4. Disabling/Enabling Scenarios

If a scenario cannot run temporarily because of a bug in the associated code, or if you want to skip this test in the current round, you can disable it.

  • Disable Operation: Right-click the scenario title and select Disable Scenario.
  • Expected Result: The entire scenario will turn gray, and a dash-in-a-circle icon will appear on the left. The engine will skip it during automation execution. image

  • Re-enable: Right-click the grayed-out scenario title again and select Enable Scenario. The scenario will return to its normal highlighted state.

results matching ""

    No results matching ""