1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
# polkit integration test suite
polkit's integration test suite uses TMT (Test Management Tool [0]) to organize and run tests. Since TMT
offers a _lot_ of features, this document pinpoints the most _interesting_ ones to get stuff up and running
quickly.
## How to contribute
Creating a new test case is pretty simple:
```
$ cd test/integration
$ tmt test create --template=shell test/name
Test directory '/home/.../polkit/test/integration/test/name' created.
Test metadata '/home/.../polkit/test/integration/test/name/main.fmf' created.
Test script '/home/.../polkit/test/integration/test/name/test.sh' created.
```
The newly created `test.sh` will be the actual test case, and `main.fmf` contains the test metadata, including
test summary & description, test dependencies, runtime, and so on. See [1] for more details.
After tweaking the test metadata it's usually a good idea to run `tmt lint test/name` to make sure that the
configuration is still valid:
```
$ tmt lint test/name
/test/name
pass C000 fmf node passes schema validation
pass C001 summary key is set and is reasonably long
...
```
To check if the test itself works as expected you can use `tmt run`:
```
$ cd test/name
$ tmt run -vvv --all provision --how local tests --name .
...
total: 1 test passed
```
The `tmt run` command is _very_ customizable (as is the rest of `tmt`). In this particular example we tell it
to run all steps (`--all`) and override the `provision` and `tests` steps to run just one particular test on
the local machine. As in previous cases, check the `tmt` documentation [0] and examples [2] for more details.
## Links
[0] https://tmt.readthedocs.io/en/stable/overview.html
[1] https://tmt.readthedocs.io/en/stable/spec/tests.html
[2] https://tmt.readthedocs.io/en/stable/examples.html#run
<!-- vim: set syntax=markdown tw=110 : -->
|