LinuxCommandLibrary

tmt-run

Execute tests within the Test Management Tool

TLDR

Run all test steps for each plan

$ tmt run
copy

Run only the discover step to show what tests would be run
$ tmt run discover -v
copy

Run all steps and adjust the provision step options
$ tmt run --all provision --how [container] --image [fedora:rawhide]
copy

Run only selected plans and tests
$ tmt run plan --name [/plan/name] test --name [/test/name]
copy

Show results from the last run in a web browser
$ tmt run --last report --how [html] --open
copy

Run tests with the provided context
$ tmt run --context [key=value] -c [distro=fedora]
copy

Run tests interactively (debug test code in the middle of a test)
$ tmt run --all execute --how [tmt] --interactive
copy

Use dry mode to see what actions would happen and use the highest verbosity
$ tmt run --dry -vvv
copy

SYNOPSIS

tmt run [OPTIONS] [COMMANDS...]
tmt run discover [discover_options] execute [execute_options] report [report_options]
tmt run plan --name /path/to/plan [plan_options]
The tmt run command itself initiates a test run, often followed by specific sub-commands like discover, provision, prepare, execute, report, and finish, which represent stages of the test execution lifecycle. Options before sub-commands apply to the entire run, while options after sub-commands apply only to that specific stage.

PARAMETERS

--id
    Reuse an existing test run identified by its unique ID, allowing continuation or re-evaluation.

--scratch
    Start the test run from scratch, clearing any previous artifacts or cached data for a clean slate.

--dry-run
    Perform a simulated run without actually executing tests or making changes, showing what would happen.

--force
    Force the operation, overriding certain checks or previous states that might otherwise prevent the run.

--verbose
    Increase the verbosity of the output, providing more detailed information about the execution process.

--debug
    Enable debug level output, providing maximum detail for troubleshooting.

--guest
    Specify one or more guest systems or virtual environments on which to run the tests.

--plan
    Directly specify the test plan to be executed, typically a path to an FMF plan file.

--context
    Set key-value pairs for the test run context, influencing how tests or plans behave.

DESCRIPTION

tmt-run is the core command for executing test plans defined within the Test Management Tool (TMT) framework. It orchestrates the entire test lifecycle, from discovering tests to provisioning environments, preparing them, executing the tests, and finally generating reports.

It acts as the central control point for running tests, supporting various environments like local machines, virtual machines (via libvirt, Vagrant), and containers (Podman, Docker). Users define their test plans, tests, and stories using Flexible Metadata Format (FMF) files, and tmt-run interprets these definitions to automate the testing process, making it efficient and repeatable.

CAVEATS

Successful execution with tmt-run relies heavily on a correctly structured TMT project and well-defined FMF metadata files. Issues with test plan syntax, missing dependencies (e.g., specific provisioning tools like libvirt or Podman), or environment misconfigurations can lead to failures. Users should be familiar with the TMT lifecycle and debugging output to diagnose problems effectively. Complex test setups might require significant system resources.

TEST LIFECYCLE STAGES

The tmt-run command orchestrates a defined sequence of stages: discover (find tests), provision (prepare testing environment), prepare (install dependencies), execute (run tests), report (generate results), and finish (clean up). Users can run specific stages or the entire pipeline.

FLEXIBLE METADATA FORMAT (FMF)

tmt-run critically depends on test, plan, and story definitions written in FMF, a YAML-based format. This declarative approach allows for version-controlled, human-readable test specifications.

HISTORY

TMT (Test Management Tool), and by extension tmt-run, was developed by Red Hat as an open-source solution for managing and executing Linux test suites. Its development began in the late 2010s, aiming to provide a modern, declarative, and scalable approach to test automation for Fedora and other Linux distributions. tmt-run has evolved to integrate with various provisioning backends and reporting formats, becoming a robust tool for continuous integration and testing workflows in the Linux ecosystem.

SEE ALSO

tmt(1), tmt-init(1), tmt-test(1), tmt-plan(1), tmt-story(1), tmt-report(1)

Copied to clipboard