After making the first steps with tmt and investigating the provisioning options let’s now dive together a little bit more and look Under The Hood to see how plans, tests and stories work together on a couple of examples.

Plans

Use Plans to enable testing and group relevant tests together. They describe how to discover tests for execution, how to provision the environment, how to prepare it for testing, how to execute tests, report results, and finally how to finish the test job.

provision:
    how: container
    image: fedora:33
prepare:
    how: install
    package: wget
execute:
    how: tmt
    script: wget http://example.org/

Tests

Tests define attributes which are closely related to individual test cases. This includes the test script, framework, directory path where the test should be executed, maximum test duration , and packages required to run the test. Here’s an example of test metadata:

summary: Fetch an example web page
test: wget http://example.org/
require: wget
duration: 1m

Stories

Use Stories to track implementation, test and documentation coverage for individual features or requirements. Thanks to this, you can track everything in one place, including the project implementation progress.

story:
    As a user I want to see more detailed information for
    particular command.
example:
  - tmt test show -v
  - tmt test show -vvv
  - tmt test show --verbose

Core attributes

Core attributes cover general metadata. This includes: summary or description for describing the content; the enabled attribute for disabling and enabling tests, plans, and, stories; and the link key which tracks relations between objects.

description:
    Different verbose levels can be enabled by using the
    option several times.
link:
  - implemented-by: /tmt/cli.py
  - documented-by: /tmt/cli.py
  - verified-by: /tests/core/dry

Have a look at the whole chapter to learn more details and get some more context. See the Fedora Guide to learn even more about enabling tmt tests in the CI.