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
cuketest mcp cuketest mcp [options] Starts the built-in MCP server

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 feature1.feature file 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 information of CukeTest.
--install-extension <extension-path> Installs an extension from the specified file path (usually a .vsix file).
--uninstall-extension <extension-name> Uninstalls the specified extension.
--list-extensions Lists all installed extensions.
-m, --man Opens the help document
-h, --help Displays help information for the command

Usage Examples:

  • Install extension: cuketest --install-extension <extension-path>

  • Uninstall extension: cuketest --uninstall-extension <extension-name>

  • List extensions: cuketest --list-extensions

cuketest run

The cuketest run command is the core of the CukeTest CLI, offering rich options to customize test execution configurations.

Option Description
--file <path> [args...] Runs the specified script file (.js, .py).
--profile <value> Selects a predefined run profile for testing, suitable for projects with different test configurations.
-f, --format <value> Sets the report format (html, simple, word, json) to adapt to different reporting needs.
--overwrite Overwrites old reports when generating new ones to avoid file accumulation.
-t, --tags <value> Filters features or scenarios by tags.
-o, --out <value> Specifies the directory to store reports and other output files.
-v, --video Records a video of the entire test process.
--no-video Forces the video recording off to reduce resource consumption.
--custom <value> Passes custom environment variables or configuration data to the test run context.
--fail-fast Stops execution immediately upon the first failed test, facilitating quick debugging.
--screen <index> Specifies the screen index for video recording in multi-monitor setups.
--no-color Disables colored console output to solve garbled text issues in certain CI or scheduled task environments.
--headless Runs in headless mode (currently only supported on Linux).
-h, --help Displays help information.

Usage Examples:

  • Run project with default configuration: cuketest run

  • Run project, generate HTML report and record video: cuketest run --format html --video

  • Run tests filtered by tags: cuketest run -t "@backend or @ui"

  • Run a specific script and pass arguments: cuketest run --file ./scripts/check_status.js --env=prod --user-role=admin

    In this example, --env=prod and --user-role=admin will be passed directly to the check_status.js script as arguments.

  • Use a specific profile: cuketest run --profile "regression_test"

    Here regression_test is a pre-defined configuration in the config/cucumber.yml file. For more details on how to configure and use different run profiles, please refer to the Project Run Profiles document.

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

    In some terminals (e.g., Jenkins or Windows Task Scheduler) where colored display is not supported, the output may appear garbled. In these cases, using the --no-color option ensures monochrome output, maintaining readability.

cuketest worker

The cuketest worker command is used to start CukeTest's remote worker to receive automation requests locally or remotely. It supports the following options:

Option Description
--show-caps Displays the worker's capabilities and environment configuration information.
--agent-port <port> Sets the port for the Worker to accept connections from the Embedded Qt Worker
--log <value> Sets the log level, optional values are error, warn, info, debug, default is error.
--log-file <value> Specifies the log file path for storing log information.
--minimize Automatically minimizes all windows after the worker starts to avoid interference with subsequent runs.
--port <value> Specifies the listening port for the worker, used for custom network configurations. Default is 3131.
--single-client Restricts to a single client connection, ensuring the independence and security of the tests.
--diag-agent Enables diagnostic mode to facilitate analyzing and solving problems.
-h, --help Displays help information for the command.
--config-license <value> Used to import a license certificate, the parameter can be the URL of a license server or the path to a .lic file.

cuketest batch

The cuketest batch command allows users to batch run multiple CukeTest projects via .cukerun files:

Option Description
*.cukerun Executes batch tests using the specified cukerun file
--ui Opens the batch tool's graphical interface
--no-color Disables colored output during batch runs
--out <value> Specifies the output directory for report files
--headless Runs batch tests without showing the user interface, this option is only supported on Linux.
-h, --help Displays help information for the command.

cuketest launch

The cuketest launch command is used to launch the test application, loading CukeTest's automation plugins (such as Qt, GuiText) at startup.:

Option Description
-q --qt Loads the Qt plugin at startup, suitable for automating Qt applications.
-h, --help Displays help information for the command.

cuketest mcp

cuketest mcp is used to start CukeTest's built-in MCP server. Currently, Playwright MCP is built-in and can be started directly to connect with MCP-supported client tools.

cuketest mcp --port 8801

After starting, it will listen on an address like http://localhost:8801, and the MCP endpoint is:

http://localhost:8801/mcp

You can add this to the client configuration:

{
  "mcpServers": {
    "playwright": {
      "url": "http://localhost:8801/mcp"
    }
  }
}

If you need compatibility with legacy SSE transport, you can use the /sse endpoint.

CLI for Windows Store Version

For the Windows Store version of CukeTest, running tests from the command line needs to follow specific Windows Store guidelines. This means that command line parameters might differ from other desktop application versions. Here are the steps to run tests from the command line:

  1. In the CukeTest application, go to the Run menu and select the Run Profiles option.

  2. In the profile editing dialog, set your test configurations according to your requirements. Once finished, at the bottom of the dialog, you will see the generated command line parameters, which you can copy.

  3. Click the Open Console Window button, which will open a command line interface.

  4. In the opened console window, paste the text you just copied.

This way, you can use the command line to run and manage your CukeTest projects in the Windows Store version environment.

CLI for macOS

CukeTest also provides full command line support on Mac, with command formats largely identical to Windows and Linux versions. You can generate the required command line in the "Run Profiles" dialog and use it freely in the terminal.

When executing the cuketest command in macOS Terminal, the cuketest command should be changed to:

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

Configuring System Permissions

To ensure that CukeTest can smoothly execute automated tests in the Mac command line environment, especially tests involving screen operations, you need to grant "Screen Recording" and "Accessibility" permissions to the terminal application in Mac's "System Preferences". This step is very important to ensure the smooth execution of tests. For detailed setup steps, please refer to our Mac Platform Installation Guide, which contains detailed instructions and illustrations to help you complete the relevant configurations.

Through the above settings, no matter which operating system version of CukeTest you use, you can efficiently manage and execute automated tests via the command line interface.

results matching ""

    No results matching ""