Step Editing
This section introduces how to add and edit Steps, the core components of a test scenario, in CukeTest, and how to flexibly use various parameter forms (such as Doc Strings and Step Tables) when a step needs to pass different types of data.
What is a Step?
If we consider a "Scenario" as a complete test case, then "Steps" are the step-by-step operating instructions within that case. Each step corresponds to a section of automation script (Step Definition) in the background.
Keyword Description
In standard BDD writing, a well-formed step always begins with a specific keyword:
- Given: Sets the initial conditions of the scenario. Example: "Given the user is logged into the system."
- When: Executes a triggering action. Example: "When the user clicks the submit button."
- Then: Verifies the expected results after execution. Example: "Then the page should display a success message."
- And / But: Used to connect multiple steps of the same type to make the statements smoother.
Tip
Best Practice: Wisely combining the logic of Given, When, and Then makes test reports feel as natural as human language, allowing even non-technical stakeholders to understand the business purpose of the test.
Adding and Inserting Steps
Adding steps in CukeTest's Visual Mode is very intuitive:
1. Appending a Step at the End of a Scenario
Every time you create a new scenario, there is a green Add a Step button at the bottom of the scenario box.
- Action: Click this button.
- Expected Result: A new highlighted step box will be added at the very end of the scenario.

2. Inserting Before a Specific Step
If you need to insert a step in the middle of a pre-arranged sequence:
- Action: Click any existing step. A floating toolbar will appear in the top-right corner of that step box. Click the insert button with the
+sign. - Expected Result: A brand new blank step will be inserted directly above the step you clicked.

Editing Step Content
Once a step is created, you can modify its description text in two ways:
Direct Double-click: Double-click the step area, and the text part will turn into an input box.

Via Context Menu: Right-click the step you want to modify, and in the floating toolbar that appears, click the "Edit" button.

Guide to Passing Values in Step Parameters
In many cases, our general operation steps need to include different data (e.g., entering "Alice" as the username and a password of length 6). In these cases, we need to know how to "pass parameters" to the underlying automation script.
In CukeTest, there are three main ways to pass data, suitable for different scenario needs:
| Parameter Method | How to Write | When to Use / Suitable Scenarios | Parameter Type in Code |
|---|---|---|---|
| 1. Placeholders / Direct Passing | Write values directly in the step: Given the user enters password 12345. Or use <variable_name> to take values from an Examples table. |
Most common. Parameters are short and concise, suitable for single-line variables (e.g., quantities, single names). | Basic types (e.g., int, string) |
| 2. Doc String | Attach a text block enclosed by """ below the step. |
When the parameter is a long block of text, such as an email body, full JSON, or XML. | string type long text |
| 3. Step Table | Attach a data table separated by | below the step. | When the parameter is a set of structured data, such as batch-creating users or form data. | Table object (e.g., DataTable / Table) |
Warning
Note: For any single step, you can only choose to append either a Doc String or a Step Table, but not both.
Doc String
What is it? It allows you to pass a large, multi-line block of clean text to the step definition at once, without needing tedious newline escape characters.
Instructions:
- Click or hover over a step. In the toolbar that appears, find and click the
Add Doc Stringicon.
(Or, right-click the step and selectAdd Doc String) - Write the long content in the newly appeared text box.
Expected Result: When you switch to Text Mode, a block area enclosed by three double quotes """ will appear below the step:
Given the packet message for the API request is as follows
"""
{
"user_name": "Tom",
"action": "login"
}
"""
The generated automation code definition will automatically receive the contents of this block and pass it as the first parameter:
// JavaScript example
Given("the packet message for the API request is as follows", async function (docString) {
// the docString parameter now receives the entire JSON string including braces and newlines
console.log(docString);
return 'pending';
});# Python example
from leanproAuto import Util
@Given("the packet message for the API request is as follows")
def step_impl(context, doc_string):
# the doc_string parameter now receives the entire JSON string including braces and newlines
print(doc_string)
pass
Step Table
What is it? It is bound directly to the step above it (distinct from the driver-level Examples table in a Scenario Outline) and is used to pass a data matrix for that specific step operation.
Instructions:
- Click a step and click
Add Table(an icon resembling a table) in the floating toolbar.
(Or, right-click the step and selectAdd Table) - Double-click the column headers to rename them and fill in the batch data within the cells.
Expected Result: The generated automation code will receive a special DataTable object. The engine provides powerful built-in APIs to parse this table data into arrays or JS object collections at any time.
For advanced usage of table data conversion in the underlying code, please refer to the Data Table Object Operation Guide.