1TMT(1) User Commands TMT(1)
2
3
4
6 tmt - Test Management Tool
7
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
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
47 Command line usage is straightforward:
48
49 tmt command [options]
50
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
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
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 RHEL 8 and CentOS 8, first make sure that you have available the
198 EPEL repository:
199
200 sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
201 sudo dnf install tmt
202
203 For plugins which cannot work outside of VPN and so live within its
204 walls you need to enable the internal copr repository first. Then you
205 can install either everything or only those you need:
206
207 sudo dnf install tmt-redhat-all
208 sudo dnf install tmt-redhat-*
209
210 Impatient to try the fresh features as soon as possible? Install the
211 latest greatest version from the copr repository:
212
213 sudo dnf copr enable psss/tmt
214 sudo dnf install tmt
215
216 Not sure, just want to try out how it works? Experiment safely and eas‐
217 ily inside a container:
218
219 podman run -it --rm quay.io/testing-farm/tmt bash
220 podman run -it --rm quay.io/testing-farm/tmt-all bash
221
222 When installing using pip you might need to install additional packages
223 on your system:
224
225 sudo dnf install gcc {python3,libvirt,krb5,libpq}-devel
226 pip install --user tmt
227
228 Note: You can omit the --user flag if in a virtual environment.
229
231 The rpm package includes a system wide script which enables the command
232 line completion for bash so no additional config should be needed. If
233 you use a different installation method or prefer another shell, see
234 the instructions below.
235
236 For Bash, add this to ~/.bashrc:
237
238 eval "$(_TMT_COMPLETE=source_bash tmt)"
239
240 For Zsh, add this to ~/.zshrc:
241
242 eval "$(_TMT_COMPLETE=source_zsh tmt)"
243
244 For Fish, add this to ~/.config/fish/completions/tmt.fish:
245
246 eval (env _TMT_COMPLETE=source_fish tmt)
247
248 Open a new shell to enable completion. Or run the eval command directly
249 in your current shell to enable it temporarily.
250
252 The following exit codes are returned from tmt run. Note that you can
253 use the --quiet option to completely disable output and only check for
254 the exit code.
255
256 0 At least one test passed, there was no fail, warn or error.
257
258 1 There was a fail or warn identified, but no error.
259
260 2 Errors occured during test execution.
261
262 3 No test results found.
263
265 The following environment variables can be used to modify behaviour of
266 the tmt command.
267
268 TMT_DEBUG
269 Enable the desired debug level. Most of the commands support
270 levels from 1 to 3. However, some of the plugins go even deeper
271 when needed.
272
273 NO_COLOR
274 Disable colors in the terminal output. Output only plain,
275 non-colored text. See https://no-color.org/ for more informa‐
276 tion.
277
279 Git: https://github.com/psss/tmt
280
281 Docs: http://tmt.readthedocs.io/
282
283 Stories: https://tmt.readthedocs.io/en/latest/stories.html
284
285 Issues: https://github.com/psss/tmt/issues
286
287 Releases: https://github.com/psss/tmt/releases
288
289 Copr: http://copr.fedoraproject.org/coprs/psss/tmt
290
291 PIP: https://pypi.org/project/tmt/
292
293 Travis: https://travis-ci.org/psss/tmt
294
295 Coveralls: https://coveralls.io/github/psss/tmt
296
297 Metadata Specification: https://tmt.readthedocs.io/en/latest/spec.html
298
299 Flexible Metadata Format: http://fmf.readthedocs.io/
300
301 Packit & Testing Farm: https://packit.dev/testing-farm/
302
304 Petr Šplíchal, Miro Hrončok, Alexander Sosedkin, Lukáš Zachar, Petr
305 Menšík, Leoš Pol, Miroslav Vadkerti, Pavel Valena, Jakub Heger, Honza
306 Horák, Rachel Sibley, František Nečas, Michal Ruprich, Martin Kyral,
307 Miloš Prchlík, Tomáš Navrátil, František Lachman, Patrik Kis, Ondrej
308 Mosnáček, Andrea Ficková, Denis Karpelevich, Michal Srb, Jan Ščotka,
309 Artem Zhukov, Vinzenz Feenstra, Inessa Vasilevskaya, Štěpán Němec and
310 Robin Hack.
311
313 Copyright (c) 2019 Red Hat, Inc.
314
315 This program is free software; you can redistribute it and/or modify it
316 under the terms of the MIT License.
317
318
319
320
321 September 2019 TMT(1)