Command Line Interface

CukeTest provides a feature-rich Command Line Interface (CLI), allowing it to be operated not only via a graphical interface but also from the terminal to run and manage test projects.
The command line functionality of CukeTest offers the following advantages:

  • It can be easily integrated into Continuous Integration (CI) and Continuous Delivery (CD) pipelines, enabling fast feedback and quality assurance for automated testing.
  • It provides flexible test parameter configurations, such as run profiles, test tags, and report formats.

Note: The command line instructions differ between the desktop and Windows Store versions of CukeTest. When switching between versions, make sure to use the corresponding commands.

Command Line Interface

Basic Usage

The table below lists the basic CukeTest CLI commands and their usage:

Command Usage Description
cuketest cuketest [file or folder] Opens the specified file or folder in CukeTest
cuketest run cuketest run [options] Runs the CukeTest project in the current directory
cuketest worker cuketest worker [options] Starts a CukeTest execution worker
cuketest batch cuketest batch [options] [*.cukerun] Batch run multiple CukeTest projects
cuketest launch cuketest launch [options] <app_name> Launches the specified application

Below are some common CLI operation examples:

1. Open a project

  • To open the current directory as a project in CukeTest, use:

     cuketest .
    

    This opens the current directory as the project root in CukeTest.

2. Open a specific file

  • To open a specific Feature file in the current directory, use:

     cuketest feature/feature1.feature
    

    For example, this opens the file feature1.feature under the feature subdirectory in CukeTest.

3. Run a project

  • To run the project in the project directory, use:
     cuketest run
    
    This executes the automated tests in the project with default configuration.

Command Line Options

The CukeTest CLI provides various options, allowing users to customize test execution and environment settings according to different scenarios.
The main CukeTest command line options are described below:

cuketest

This is the basic command, used to launch CukeTest or obtain help information.

Option Description
-V, --version Displays the current version of CukeTest
-m, --man Opens the help manual
-h, --help Displays help information for the command

cuketest run

The cuketest run command is one of the key components of the CukeTest CLI, offering rich options to customize test run configurations.

Option Description
--file <value> Runs the specified script file (.js, .py), useful for quickly testing or debugging a single scenario
--profile <value> Selects a predefined run profile for testing, suitable for projects with multiple configurations
-f, --format <value> Sets the report format (html, simple, word, json) to meet different reporting needs and environments
--overwrite Overwrites existing reports when generating new ones, avoiding excessive report files
-t --tags <value> Filters scenarios by tag, providing flexibility in test execution
-o --out <value> Specifies the output directory for reports and other files
-v --video Records a video of the entire test run, useful for analysis and review
--no-video Disables video recording when not needed, reducing resource usage
--custom <value> Passes custom parameters to the test environment, suitable for scenarios requiring extra input
--fail-fast Stops execution immediately upon the first test failure, allowing quick problem localization
--screen <value> Specifies which screen to record in multi-monitor setups
--no-color Disables color codes in environments that do not support colored output
--headless Runs tests without showing the user interface; only supported on Linux
-h, --help Displays help information for the command

Examples of usage:

  • Run project with default configuration: cuketest run
  • Run project and generate HTML report: cuketest run --format html
  • Generate HTML report and record video: cuketest run --format html --video
  • Run tests with specific tags: cuketest run -t "@backend or @ui"
  • Run project with a specific profile: cuketest run --format html --profile "math profile"

    Here, "math profile" is a pre-defined configuration in config/cucumber.yml. For more details on configuring and using different run profiles, refer to Project Run Profiles.

  • Run a specific feature file: cuketest run feature/feature1.feature

  • Disable colored output: cuketest run --no-color

    In some terminals (e.g., Jenkins or Windows Task Scheduler), color output may not be supported and may appear garbled. Using --no-color ensures monochrome output and readability.

cuketest worker

The cuketest worker command starts a CukeTest remote worker to receive automation requests locally or remotely.
Available options include:

Option Description
--show-caps Displays the worker's capabilities and environment information
--agent-port <port> Sets the port for the Worker to accept connections from Embedded Qt Worker
--log <value> Sets log level; options: error, warn, info, debug (default: error)
--log-file <value> Specifies the log file path for storing logs
--minimize Automatically minimizes all windows after worker start to avoid interference
--port <value> Specifies the listening port for the worker; default is 3131
--single-client Restricts to a single client connection, ensuring test isolation and security
--diag-agent Enables diagnostic mode for troubleshooting
-h, --help Displays help information
--config-license <value> Imports license; can be a license server URL or .lic file path

cuketest batch

The cuketest batch command allows batch execution of multiple CukeTest projects using .cukerun files:

Option Description
*.cukerun Executes batch tests using the specified cukerun file
--ui Opens the batch tool graphical interface
--no-color Disables color output during batch execution
--out <value> Specifies the output directory for report files
--headless Runs batch tests without showing UI; only supported on Linux
-h, --help Displays help information

cuketest launch

The cuketest launch command launches the test application and loads CukeTest automation plugins (such as Qt, GuiText):

Option Description
-q --qt Loads the Qt plugin for automating Qt applications
-h, --help Displays help information

CLI for Windows Store Version

For the Windows Store edition of CukeTest, command line testing follows specific Windows Store guidelines, meaning parameters may differ from desktop versions. Steps to run tests from the CLI:

  1. In CukeTest, go to the Run menu and select Run Profiles.
  2. Configure your test settings in the profile editor dialog. At the bottom, you will see the generated CLI command, which you can copy.
  3. Click Open Console Window to open a terminal.
  4. Paste the copied command into the console.

You can now run and manage your CukeTest projects via the CLI in the Windows Store environment.

CLI for macOS

CukeTest also provides full CLI support on macOS, with command formats similar to Windows and Linux.
Commands can be generated in the "Run Profiles" dialog and used directly in the terminal.

When running cuketest in macOS Terminal, replace it with:

/Applications/CukeTest.app/Contents/MacOS/cuke

Configuring System Permissions

To ensure CukeTest can execute automation tests on macOS, especially those involving screen interactions, you must grant "Screen Recording" and "Accessibility" permissions to the terminal application in System Preferences.
This step is critical for successful test execution.

For detailed instructions, refer to our macOS Installation Guide, which includes step-by-step illustrations to help you complete the setup.

With the above configuration, CukeTest can efficiently manage and execute automated tests via CLI on any supported operating system.