Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Getgauge Taiko Gauge Run

From Leeroopedia
Knowledge Sources
Domains Testing, CI_CD, Test_Execution
Last Updated 2026-02-12 00:00 GMT

Overview

External tool procedure for running Gauge test suites with Taiko browser automation, including reporting, parallel execution, and containerized deployment.

Description

gauge run is the Gauge CLI command that orchestrates the full test execution lifecycle. The Taiko repository's functional test suite defines its execution in test/functional-tests/package.json:

{
  "scripts": {
    "test": "gauge run -v --tags=\\!knownIssue --simple-console"
  }
}

Execution Lifecycle:

  1. Suite Initialization — Executes @BeforeSuite() hooks (starts test server, calls setConfig()).
  2. Specification Discovery — Scans specs/ for .spec files, filtered by tags.
  3. Per Scenario:
    1. Execute @BeforeScenario() (opens browser).
    2. Execute steps by matching step text to @Step() methods.
    3. On failure: invoke @CustomScreenshotWriter().
    4. Execute @AfterScenario() (closes browser).
  4. Suite Teardown — Executes @AfterSuite() (stops server).
  5. Report Generation — HTML reports in gauge_reports_dir.

Key features:

  • Tag filteringgauge run --tags "smoke" or --tags "\!knownIssue"
  • Parallel executiongauge run --parallel or gauge run -p -n=4
  • Environment selectiongauge run --env ci
  • Containerized execution — Docker with --no-sandbox, --disable-dev-shm-usage flags

Usage

This implementation is used when executing the test suite locally, in CI/CD pipelines, or in Docker containers.

Code Reference

Source Location

  • Repository: Taiko
  • Reference Files:
    • test/functional-tests/package.json — npm test script
    • docs/integrating_with_test_runners.md — Runner integration guide
    • docs/taiko_in_docker.md — Docker execution guide

CLI Commands

# Run all specs
gauge run specs/

# Run with tag filter
gauge run --tags "smoke" specs/

# Run in parallel (4 streams)
gauge run --parallel -n=4 specs/

# Run specific spec
gauge run specs/ElementsAPI.spec

# Run with specific environment
gauge run --env ci specs/

# Run via npm
npm test

I/O Contract

Inputs

Name Type Required Default Description
specs directory Path No specs/ Directory containing .spec files to execute.
--tags string No Tag expression for filtering scenarios (e.g., "smoke", "\!knownIssue").
--parallel / -p flag No false Enable parallel execution across specifications.
-n number No CPU cores Number of parallel execution streams.
--env string No default Environment directory name under env/.

Outputs

Name Type Description
Exit code number 0 if all scenarios pass, non-zero on failures.
HTML report Directory Generated in gauge_reports_dir with pass/fail details and failure screenshots.
Console output Text Scenario-level pass/fail results with step details.

Related Pages

Implements Principle

Requires Environment

See Also

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment