Running Gherkin tests
This guide explains how to run Gherkin tests locally and remotely using the Galasa CLI.
Prerequisites¶
Before running Gherkin tests, ensure you have:
-
Initialized your Galasa environment:
-
Set up Java: Ensure
JAVA_HOMEis set and points to a Java 17 JDK installation -
Created a feature file: Write your test in a
.featurefile
Running tests locally¶
Use the galasactl runs submit local command with the --gherkin flag to run Gherkin tests on your local machine.
Path format: The path must be in URL format:
- Linux/macOS:
file:///Users/username/tests/test.feature - Windows:
file:///C:/Users/username/tests/test.feature
The --log - flag sends logging output to the console (stderr).
Configuring your environment¶
Setting up CPS properties¶
For tests that interact with z/OS systems, configure your .galasa/cps.properties file:
# Gherkin uses the 'PRIMARY' tag by default
# The imageid property indicates which zos.image will be used
zos.dse.tag.PRIMARY.imageid=MYHOST
# The cluster name for your z/OS system
zos.dse.tag.PRIMARY.clusterid=PLEXNAME
# Images in the cluster (change MYHOSTIMAGE to your system name, e.g., MV2XX)
zos.cluster.PLEXNAME.images=MYHOSTIMAGE
# Hostname configuration (change MYHOST to match zos.dse.tag.PRIMARY.imageid)
# Change machine.hostname to your actual hostname or IP address
zos.image.MYHOST.default.hostname=machine.hostname
zos.image.MYHOST.ipv4.hostname=machine.hostname
# Sysplex configuration (change PLEXNAME to match zos.dse.tag.PRIMARY.clusterid)
zos.image.MYHOST.sysplex=PLEXNAME
# Telnet configuration
zos.image.MYHOST.telnet.port=23
zos.image.MYHOST.telnet.tls=false
Configuration steps:
- Replace
MYHOSTwith your chosen image identifier - Replace
PLEXNAMEwith your z/OS cluster name - Replace
MYHOSTIMAGEwith your actual system name - Replace
machine.hostnamewith your system's hostname or IP address
Terminal size configuration¶
You can set default terminal dimensions using CPS properties:
# Default terminal size for Gherkin tests
zos3270.gherkin.terminal.rows=24
zos3270.gherkin.terminal.columns=80
These values can be overridden in your feature file or using override properties.
Example: Running a simple test¶
Create a feature file¶
Create a file named test1.feature:
Run the test¶
Troubleshooting¶
Common issues¶
Issue: JAVA_HOME not set
- Solution: Set the
JAVA_HOMEenvironment variable to your Java 17 JDK installation
Issue: Feature file not found
- Solution: Ensure the path is in URL format and the file exists at that location
Issue: Connection timeout to z/OS system
- Solution: Verify your CPS properties are correct and the system is accessible
Issue: Step definition not found
- Solution: Check that you are using a supported step definition from the Available step definitions list
Getting help¶
If you encounter issues:
- Check the CLI prerequisites
- Verify your local environment initialization
- Review the Available step definitions
- Check the Galasa logs for detailed error messages
Command reference¶
For complete command syntax and all available options, see galasactl runs submit local