LinuxCommandLibrary

tmt-try

Test changes locally before submitting them

TLDR

Quickly experiment with the default provision method (no tests in the CWD)

$ tmt try
copy

Run a test in the current working directory
$ cd [path/to/test] && tmt try
copy

Use a specific operating system
$ tmt try [fedora-41]
copy

Select both custom image and provision method
$ tmt try [fedora@container]
copy

Select tests with custom filter
$ tmt try --test [feature]
copy

Provision guest and wait for instructions
$ tmt try --ask
copy

Directly log into the guest without asking
$ tmt try --login
copy

Display help
$ tmt try --help
copy

SYNOPSIS

tmt try [options] []...

PARAMETERS

--help
    Show program's help message and exit.

--all
    Try all available tests. Useful when working on the plan itself.

--who
    Select tests with in the 'who' attribute.

--test
    Select tests with in the 'test' attribute.

--manual
    Only select test cases tagged as manual. Tests tagged as manual are never executed but shown to the user for manual verification.

--force
    Ignore warnings about missing configuration

--guest
    Target guest(s) for test execution. Defaults to the default guest if none is set. This will select the defined guest(s), create it if it's not existing yet, provision and execute the tests on it.

--distro
    Distro to be used for test execution in case a guest is not yet defined. Defaults to the default distro if none is set. This defines a new guest based on the given distro.

--show
    Show available tests and exit. Does not execute any tests.

--format
    Output format, defaults to the default set in the tmt config. Supported formats: text, json, yaml.

--verbose
    Display verbose output.

--debug
    Display debug output.

DESCRIPTION

The tmt-try command is a powerful tool within the tmt framework, designed for executing tests directly from a test plan.
It simplifies the process of testing changes by providing a streamlined way to run individual tests or entire test suites against a variety of environments. This command allows users to quickly verify the correctness of code modifications or configuration changes without requiring complex setup or deployment procedures.

The tmt-try command leverages the metadata defined in the tmt plan to configure and execute the test, making it an efficient and reliable method for testing. The configuration enables users to test code against different operating systems, architectures, and software versions. By using the tmt-try command, developers and testers can easily isolate and debug problems, ultimately leading to higher quality and more stable software.

SELECTING TESTS

Tests can be selected individually by name, using the --test option, or by specifying attributes such as 'who' (e.g., --who developer). The --all option runs all tests defined in the plan. When selecting tests, the names or attributes given must match those defined in the plan's metadata.

EXECUTION ENVIRONMENT

The tmt-try command can execute tests on different environments specified by the --guest or --distro options. When a guest is defined, the command uses the available guest to execute the tests. When a guest is not defined, it uses the given distro to define a new guest which will then be used to execute the tests. By default it will use the default guest if a guest is defined and the default distro if no guest is defined.
Caveat: Ensure that the guest images/distributions and their required dependencies are correctly configured for successful test execution.

HISTORY

The tmt-try command is a core component of the Test Management Tool (tmt) ecosystem, developed to provide a streamlined testing workflow. Its development was driven by the need for a simple and efficient way to run tests locally during development and debugging cycles. Over time, it has evolved to support a variety of execution environments and test selection methods, reflecting the growing complexity of software testing needs.

SEE ALSO

tmt(1), tmt-run(1), tmt-plan(1)

Copied to clipboard