1TMT(1)                           User Commands                          TMT(1)
2
3
4

NAME

6       tmt - Test Management Tool
7

DESCRIPTION

9       The  tmt tool provides a user-friendly way to work with tests.  You can
10       comfortably create new tests, safely and easily run tests  across  dif‐
11       ferent  environments,  review  test results, debug test code and enable
12       tests in the CI using a consistent and concise config.
13
14       The python module and command-line tool implement the Metadata Specifi‐
15       cation  which  allows  storing  all needed test execution data directly
16       within a git repository. Together with possibility to reference  remote
17       repositories  it  makes  it easy to share test coverage across projects
18       and distros.
19
20       The Flexible Metadata Format fmf is used to store data  in  both  human
21       and  machine  readable  way close to the source code. Thanks to inheri‐
22       tance and elasticity metadata are  organized  in  the  structure  effi‐
23       ciently, preventing unnecessary duplication.
24

SPECIFICATION

26       There are several metadata levels defined by the specification:
27
28       Core  attributes such as summary or description which are common across
29       all levels are defined by the special L0 metadata.
30
31       Tests, or L1 metadata, define attributes which are closely  related  to
32       individual  test  cases  such as test script, framework, directory path
33       where the test should be executed, maximum test  duration  or  packages
34       required to run the test.
35
36       Plans,  also  called  L2 metadata, are used to group relevant tests and
37       enable them in the CI. They describe how to discover tests  for  execu‐
38       tion,  how to provision the environment, how to prepare it for testing,
39       how to execute tests and report test results.
40
41       Stories, which implement the L3 metadata, can be used to  track  imple‐
42       mentation,  test  and documentation coverage for individual features or
43       requirements. Thanks to this you can track everything in one place, in‐
44       cluding the project implementation progress.
45

SYNOPSIS

47       Command line usage is straightforward:
48
49          tmt command [options]
50

EXAMPLES

52       Let's see which tests, plans and stories are available:
53
54          tmt
55
56       Initialize  the metadata tree in the current directory, optionally with
57       example content based on templates:
58
59          tmt init
60          tmt init --template base
61
62       Run all or selected steps for each plan:
63
64          tmt run
65          tmt run discover
66          tmt run prepare execute
67
68       List tests, show details, check against the specification:
69
70          tmt test ls
71          tmt test show
72          tmt test lint
73
74       Create a new test, import test metadata from other formats:
75
76          tmt test create
77          tmt test import
78
79       List plans, show details, check against the specification:
80
81          tmt plan ls
82          tmt plan show
83          tmt plan lint
84
85       List stories, check details, show coverage status:
86
87          tmt story ls
88          tmt story show
89          tmt story coverage
90
91       Many commands support regular expression filtering and  other  specific
92       options:
93
94          tmt story ls cli
95          tmt story show create
96          tmt story coverage --implemented
97
98       Check  help  message of individual commands for the full list of avail‐
99       able options.
100

OPTIONS

102       Here is the list of the most frequently used commands and options.
103
104   Run
105       The run command is used to execute test  steps.  By  default  all  test
106       steps  are run. See the L2 Metadata specification for detailed descrip‐
107       tion of individual steps. Here is a brief overview:
108
109       discover
110              Gather information about test cases to be executed.
111
112       provision
113              Provision an environment for testing or use localhost.
114
115       prepare
116              Prepare the environment for testing.
117
118       execute
119              Run tests using the specified executor.
120
121       report Provide test results overview and send reports.
122
123       finish Perform the finishing tasks and clean up provisioned guests.
124
125   Test
126       Manage tests (L1 metadata). Check available tests, inspect their  meta‐
127       data,  gather  old metadata from various sources and stored them in the
128       new fmf format.
129
130       ls     List available tests.
131
132       show   Show test details.
133
134       lint   Check tests against the L1 metadata specification.
135
136       create Create a new test based on given template.
137
138       import Convert old test metadata into the new fmf format.
139
140   Plan
141       Manage test plans (L2 metadata). Search for available  plans.   Explore
142       detailed test step configuration.
143
144       ls     List available plans.
145
146       show   Show plan details.
147
148       lint   Check plans against the L2 metadata specification.
149
150   Story
151       Manage  user  stories.  Check  available user stories. Explore coverage
152       (test, implementation, documentation).
153
154       ls     List available stories.
155
156       show   Show story details.
157
158       coverage
159              Show code, test and docs coverage for given stories.
160
161       export Export selected stories into desired format.
162
163   Utils
164       Various utility options.
165
166       --root PATH
167              Path to the metadata tree, current directory used by default.
168
169       --verbose
170              Print additional information.
171
172       --debug
173              Turn on debugging output.
174
175       Check help message of individual commands for the full list  of  avail‐
176       able options.
177

INSTALL

179       The  main  tmt package provides the core features with a minimal set of
180       dependencies:
181
182          sudo dnf install tmt
183
184       In order to enable additional functionality, such as particular  provi‐
185       sion or report plugins, install the respective subpackage:
186
187          sudo dnf install tmt-test-convert
188          sudo dnf install tmt-report-html
189          sudo dnf install tmt-provision-container
190          sudo dnf install tmt-provision-virtual
191
192       If  you don't care about disk space and want to have all available fea‐
193       tures right at hand install everything:
194
195          sudo dnf install tmt-all
196
197       For CentOS and RHEL, first make sure that you have available  the  EPEL
198       repository.  You might also have to enable additional repositories:
199
200          sudo dnf config-manager --enable powertools  # CentOS 8
201          sudo dnf config-manager --enable rhel-CRB    # RHEL 8
202          sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
203
204          sudo dnf config-manager --enable crb         # CentOS 9
205          sudo dnf config-manager --enable rhel-CRB    # RHEL 9
206          sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
207
208          sudo dnf install tmt
209
210       For  plugins  which  cannot  work outside of VPN and so live within its
211       walls you need to enable the internal copr repository first.  Then  you
212       can install either everything or only those you need:
213
214          sudo dnf install tmt-redhat-all
215          sudo dnf install tmt-redhat-*
216
217       Impatient  to  try  the fresh features as soon as possible? Install the
218       latest greatest version from the copr repository:
219
220          sudo dnf copr enable psss/tmt
221          sudo dnf install tmt
222
223       Not sure, just want to try out how it works? Experiment safely and eas‐
224       ily inside a container:
225
226          podman run -it --rm quay.io/testing-farm/tmt bash
227          podman run -it --rm quay.io/testing-farm/tmt-all bash
228
229       When installing using pip you might need to install additional packages
230       on your system:
231
232          sudo dnf install gcc {python3,libvirt,krb5,libpq}-devel
233          pip install --user tmt
234
235       Note: You can omit the --user flag if in a virtual environment.
236

SHELL COMPLETION

238       The rpm package includes a system wide script which enables the command
239       line  completion  for bash so no additional config should be needed. If
240       you use a different installation method or prefer  another  shell,  see
241       the instructions below.
242
243       For Bash, add this to ~/.bashrc:
244
245          eval "$(_TMT_COMPLETE=source_bash tmt)"
246
247       For Zsh, add this to ~/.zshrc:
248
249          eval "$(_TMT_COMPLETE=source_zsh tmt)"
250
251       For Fish, add this to ~/.config/fish/completions/tmt.fish:
252
253          eval (env _TMT_COMPLETE=source_fish tmt)
254
255       Open a new shell to enable completion. Or run the eval command directly
256       in your current shell to enable it temporarily.
257
258       This is however run every time you start a shell which can  cause  some
259       delay.  To  speed  it up, write the generated script to a file and then
260       source it from your shell's configuration file.  All  of  this  can  be
261       achieved  using  tmt  setup completion command.  By default, it outputs
262       the completion script to the terminal but it can also add  it  to  your
263       ~/.bashrc or ~/.zshrc using the --install option:
264
265          tmt setup completion {bash, zsh, fish} --install
266

EXIT CODES

268       The  following  exit codes are returned from tmt run. Note that you can
269       use the --quiet option to completely disable output and only check  for
270       the exit code.
271
272       0      At least one test passed, there was no fail, warn or error.
273
274       1      There was a fail or warn identified, but no error.
275
276       2      Errors occured during test execution.
277
278       3      No test results found.
279

VARIABLES

281       The  following environment variables can be used to modify behaviour of
282       the tmt command.
283
284       TMT_DEBUG
285              Enable the desired debug level. Most  of  the  commands  support
286              levels  from 1 to 3. However, some of the plugins go even deeper
287              when needed.
288
289       TMT_PLUGINS
290              Path to a directory with additional plugins. Multiple paths sep‐
291              arated with the : character can be provided as well.
292
293       NO_COLOR
294              Disable  colors  in  the  terminal  output.  Output  only plain,
295              non-colored text. See https://no-color.org/  for  more  informa‐
296              tion.
297
298       The following environment variables are provided to the test during the
299       execution:
300
301       TMT_TREE
302              The full path of the working directory where the  metadata  tree
303              is  copied.  This usually contains the whole git repository from
304              which tests have been executed.
305
306       TMT_TEST_DATA
307              Path to the directory where test can store logs and other  arti‐
308              facts  generated during its execution. These will be pulled back
309              from the guest and available for inspection after the test  exe‐
310              cution is finished.
311
312       TMT_PLAN_DATA
313              Path to the common directory used for storing logs and other ar‐
314              tifacts related to the whole plan execution. It is  pulled  back
315              from  the  guest  and available for inspection after the plan is
316              completed.
317
318       TMT_SOURCE_DIR
319              Path to directory with downloaded and extracted sources  if  the
320              dist-git-source option was used in the discover step.
321
322       TMT_REBOOT_COUNT
323              During  the test execution the tmt-reboot command can be used to
324              request reboot of the guest. This variable  contains  number  of
325              reboots which already happened during the test.  Value is set to
326              0 if no reboot occurred.
327
328              In  order  to  keep  backward-compatibility  with  older  tests,
329              rhts-reboot  and  rstrnt-reboot  commands  are supported for re‐
330              questing the reboot, variables  REBOOTCOUNT  and  RSTRNT_REBOOT‐
331              COUNT contain number of reboots as well.
332
334       Git: https://github.com/teemtee/tmt
335
336       Docs: http://tmt.readthedocs.io/
337
338       Stories: https://tmt.readthedocs.io/en/stable/stories.html
339
340       Issues: https://github.com/teemtee/tmt/issues
341
342       Releases: https://github.com/teemtee/tmt/releases
343
344       Copr: http://copr.fedoraproject.org/coprs/psss/tmt
345
346       PIP: https://pypi.org/project/tmt/
347
348       Metadata Specification: https://tmt.readthedocs.io/en/stable/spec.html
349
350       Flexible Metadata Format: http://fmf.readthedocs.io/
351
352       Packit & Testing Farm: https://packit.dev/testing-farm/
353

AUTHORS

355       Petr  Šplíchal,  Miro  Hrončok,  Alexander Sosedkin, Lukáš Zachar, Petr
356       Menšík, Leoš Pol, Miroslav Vadkerti, Pavel Valena, Jakub  Heger,  Honza
357       Horák,  Rachel  Sibley,  František Nečas, Michal Ruprich, Martin Kyral,
358       Miloš Prchlík, Tomáš Navrátil, František Lachman,  Patrik  Kis,  Ondrej
359       Mosnáček,  Andrea  Ficková,  Denis Karpelevich, Michal Srb, Jan Ščotka,
360       Artem Zhukov, Vinzenz  Feenstra,  Inessa  Vasilevskaya,  Štěpán  Němec,
361       Robin  Hack,  Yulia  Kopkova,  Ondrej Moriš, Martin Zelený, Karel Šrot,
362       František Zatloukal, Simon Walter, Petr Matyáš, Yariv  Rachmani,  Pavel
363       Cahyna, Martin Litwora, Brian Grech, Vojtěch Eichler, Philip Daly, Vec‐
364       tor Li, Evgeny Fedin, Guy Inger and Petr Matyas.
365
367       Copyright Red Hat
368
369       This program is free software; you can redistribute it and/or modify it
370       under the terms of the MIT License.
371
372
373
374
375                                September 2019                          TMT(1)
Impressum