From 24b43643ed6e18334e63e8d32826aabc98a0d472 Mon Sep 17 00:00:00 2001 From: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> Date: Tue, 12 May 2026 11:39:56 +0100 Subject: [PATCH 1/2] docs: Move gherkin-related docs into their own topic Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> --- .secrets.baseline | 10 + .../runs-submit-local.md | 32 -- .../setting-up-galasa-project.md | 2 +- .../using-gherkin/gherkin-step-definitions.md | 299 ++++++++++++++++++ .../using-gherkin/gherkin-syntax-reference.md | 253 +++++++++++++++ docs/content/docs/using-gherkin/index.md | 21 ++ .../using-gherkin/running-gherkin-tests.md | 133 ++++++++ .../using-gherkin/writing-gherkin-tests.md | 188 +++++++++++ docs/mkdocs.yml | 6 + 9 files changed, 911 insertions(+), 33 deletions(-) create mode 100644 docs/content/docs/using-gherkin/gherkin-step-definitions.md create mode 100644 docs/content/docs/using-gherkin/gherkin-syntax-reference.md create mode 100644 docs/content/docs/using-gherkin/index.md create mode 100644 docs/content/docs/using-gherkin/running-gherkin-tests.md create mode 100644 docs/content/docs/using-gherkin/writing-gherkin-tests.md diff --git a/.secrets.baseline b/.secrets.baseline index 13f5ecd2e..5a8a9f770 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -390,6 +390,16 @@ "verified_result": null } ], + "docs/content/docs/using-gherkin/gherkin-step-definitions.md": [ + { + "hashed_secret": "c61db10457a740b07845146f2d1b391c133a6ebf", + "is_secret": false, + "is_verified": false, + "line_number": 142, + "type": "Secret Keyword", + "verified_result": null + } + ], "docs/content/docs/writing-own-tests/binding-tests.md": [ { "hashed_secret": "877704f69026efee10f08e8f95568749f2682203", diff --git a/docs/content/docs/cli-command-reference/runs-submit-local.md b/docs/content/docs/cli-command-reference/runs-submit-local.md index 7aa3e57e1..76df04b2e 100644 --- a/docs/content/docs/cli-command-reference/runs-submit-local.md +++ b/docs/content/docs/cli-command-reference/runs-submit-local.md @@ -71,38 +71,6 @@ Use this command to run a Java test in a local JVM: Galasa uses OBRs to locate tests and all required Managers in the specified Maven repository. -## Running a Gherkin test with the `runs submit local` command - -Use this command to run a Gherkin test in a local JVM. Note that the `--gherkin` flag is used instead of `--obr` or `--class` flags. - -=== "Linux or macOS" - - ```shell - galasactl runs submit local --log - \ - --gherkin file:///path/to/gherkin/file.feature - ``` - - -=== "Windows (Powershell)" - - ```powershell - galasactl runs submit local --log - ` - --gherkin file:///path/to/gherkin/file.feature - ``` - -**Parameters explained:** - -- `--log -`: Sends debugging information to the console (stderr). - -- `--gherkin`: Specifies the path to the Gherkin file containing your tests. The path must be in URL format and end with a `.feature` extension. - - Examples: - - - Linux/macOS: `file:///Users/myuserid/gherkin/MyGherkinFile.feature` - - Windows: `file:///C:/Users/myuserid/gherkin/MyGherkinFile.feature` - -For more information about Gherkin support, see the [Galasa CLI Gherkin documentation](https://github.com/galasa-dev/galasa/blob/main/modules/cli/gherkin-docs.md){target="_blank"}. - ## Stopping a running test diff --git a/docs/content/docs/cli-command-reference/setting-up-galasa-project.md b/docs/content/docs/cli-command-reference/setting-up-galasa-project.md index 0ce5c9070..2155e5c31 100644 --- a/docs/content/docs/cli-command-reference/setting-up-galasa-project.md +++ b/docs/content/docs/cli-command-reference/setting-up-galasa-project.md @@ -12,7 +12,7 @@ This guide explains: - How to create and build an example project - The purpose of the generated files -Once you have created and built your project, you can run tests locally. Both Java and Gherkin tests are supported. Learn more in [Running a test locally](./runs-submit-local.md). +Once you have created and built your project, you can run tests locally. Learn more in [Running a test locally](./runs-submit-local.md). ## Getting started diff --git a/docs/content/docs/using-gherkin/gherkin-step-definitions.md b/docs/content/docs/using-gherkin/gherkin-step-definitions.md new file mode 100644 index 000000000..ceaaa9870 --- /dev/null +++ b/docs/content/docs/using-gherkin/gherkin-step-definitions.md @@ -0,0 +1,299 @@ +--- +title: "Available step definitions" +--- + +This reference lists all pre-implemented step definitions available in Galasa for writing Gherkin tests. + +## General steps + +### Writing to the test log + +Write messages to the test log for debugging or documentation purposes: + +```gherkin +THEN Write to log "Your message here" +``` + +**Example:** +```gherkin +THEN Write to log "Starting test execution" +``` + +## 3270 Terminal steps + +These steps allow you to interact with 3270 terminal applications. + +### Allocating terminals + +Allocate a terminal for your scenario to use: + +```gherkin +GIVEN a terminal +GIVEN a terminal with id of xxx +GIVEN a terminal tagged yyy +GIVEN a terminal with id of xxx tagged yyy +``` + +**Parameters:** + +- **id**: A name to identify the terminal when using multiple terminals in one scenario. Default is `A`. +- **tag**: Specifies which system to connect to. Default is `PRIMARY`. + +**Examples:** +```gherkin +GIVEN a terminal +GIVEN a terminal with id of B +GIVEN a terminal tagged SECONDARY +GIVEN a terminal with id of C tagged BACKUP +``` + +### Specifying terminal size + +You can specify the terminal dimensions in your scenario: + +```gherkin +GIVEN a terminal with 48 rows and 160 columns +GIVEN a terminal B with 24 rows and 160 columns +GIVEN a terminal C tagged ABCD with 24 rows and 80 columns +``` + +**Default size:** 24 rows × 80 columns + +**Configuration:** You can also set terminal size using CPS properties: + +- `zos3270.gherkin.terminal.rows` (default: 24) +- `zos3270.gherkin.terminal.columns` (default: 80) + +Priority order: Scenario specification > Override properties > CPS properties > Default values + +### Pressing special keys + +Send Program Function (PF) keys to the terminal: + +```gherkin +AND press terminal key PF1 +AND press terminal key PF2 +... +AND press terminal key PF24 +``` + +**For named terminals:** +```gherkin +AND press terminal A key PF1 +``` + +### Pressing special character keys + +Send special character keys to the terminal: + +```gherkin +AND press terminal key TAB +AND press terminal key BACKTAB +AND press terminal key ENTER +AND press terminal key CLEAR +``` + +**For named terminals:** +```gherkin +AND press terminal A key ENTER +``` + +### Typing text + +Send text to the terminal: + +```gherkin +AND type "xxx" on terminal +AND type "xxx" on terminal in field labelled "yyy" +AND type "xxx" on terminal A in field labelled "yyy" +``` + +**Parameters:** + +- **xxx**: The text to type +- **yyy**: The label of the field to type into +- **A**: The terminal ID (if using multiple terminals) + +**Examples:** +```gherkin +AND type "LOGON" on terminal +AND type "myusername" on terminal in field labelled "User ID" +AND type "CICS" on terminal B in field labelled "Application" +``` + +### Using credentials + +Type credentials from the credentials store: + +```gherkin +AND type credentials MYCREDS1 username on terminal +AND type credentials MYCREDS1 password on terminal +AND type credentials MYCREDS1 username on terminal A +AND type credentials MYCREDS1 password on terminal A +``` + +**Parameters:** + +- **MYCREDS1**: The credential name from your credentials store + +**Credentials configuration example** (`credentials.properties`): +```properties +secure.credentials.MYCREDS1.username=myuserid +secure.credentials.MYCREDS1.password=mypassw0rd +``` + +**Example scenario:** +```gherkin +Scenario: Login with stored credentials + GIVEN a terminal + THEN wait for "Login" in any terminal field + AND type credentials MAINFRAME username on terminal + AND press terminal key TAB + AND type credentials MAINFRAME password on terminal + AND press terminal key ENTER +``` + +### Positioning the cursor + +Move the terminal cursor to a specific field: + +```gherkin +AND move terminal cursor to field "xxx" +``` + +**Example:** +```gherkin +AND move terminal cursor to field "Command" +``` + +### Waiting for responses + +Wait for the terminal to be ready or for specific text to appear: + +```gherkin +AND wait for terminal keyboard +AND wait for terminal A keyboard +THEN wait for "xxx" in any terminal field +THEN wait for "xxx" in any terminal A field +``` + +**Examples:** +```gherkin +AND wait for terminal keyboard +THEN wait for "Ready" in any terminal field +THEN wait for "CICS" in any terminal B field +``` + +### Checking terminal output + +Verify that specific text appears on the terminal: + +```gherkin +THEN check "xxx" appears only once on terminal +THEN check "xxx" appears only once on terminal A +``` + +**Examples:** +```gherkin +THEN check "Transaction complete" appears only once on terminal +THEN check "Error" appears only once on terminal B +``` + +## Configuration property steps + +### Retrieving test properties + +Get values from the Configuration Property Store (CPS): + +```gherkin +GIVEN is test property namespace.property.name +``` + +**Note:** The `test` namespace prefix is automatically added, so you only specify the property name. + +**Examples:** +```gherkin +GIVEN is test property fruit.name +GIVEN is test property server.port +GIVEN is test property connection.timeout +``` + +**Using the variable:** +```gherkin +Feature: Configuration Test + Scenario: Use configured fruit name + GIVEN is test property fruit.name + THEN Write to log "Testing with " +``` + +## Complete terminal interaction example + +Here is a complete example showing multiple step definitions working together: + +```gherkin +Feature: CICS Transaction Test + + Scenario: Execute CICS transaction + # Allocate and configure terminal + GIVEN a terminal with 24 rows and 80 columns + + # Login to system + THEN wait for "VTAM" in any terminal field + AND type "LOGON APPLID(CICSRGN1)" on terminal + AND press terminal key ENTER + AND wait for terminal keyboard + + # Enter credentials + THEN wait for "User ID" in any terminal field + AND type credentials CICS username on terminal + AND press terminal key TAB + AND type credentials CICS password on terminal + AND press terminal key ENTER + + # Wait for CICS ready + THEN wait for "CICS" in any terminal field + AND press terminal key CLEAR + AND wait for terminal keyboard + + # Execute transaction + AND type "MYTR" on terminal + AND press terminal key ENTER + + # Verify result + THEN wait for "Transaction completed" in any terminal field + THEN check "Success" appears only once on terminal +``` + +## Step definition syntax patterns + +When writing steps, follow these patterns: + +**Terminal allocation:** + +- `GIVEN a terminal [with id of ] [tagged ] [with rows and columns]` + +**Typing:** + +- `AND type "" on terminal [] [in field labelled "