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.
After the initial hint describing the very first steps with tmt, let’s have a look at the available test execution options. Recall the user story from the very beginning:
As a tester or developer, I want to easily run tests in my preferred environment.
Do you want to safely run tests without breaking your laptop? Use the default provision method virtual which will execute tests under a virtual machine using libvirt with the help of testcloud:Continue reading
For those who still haven’t heard: tmt is now fully-supported in Packit, Fedora Continuous Integration (CI) system, and the RHEL CI system. Now you can use the same concise and consistent config to enable tests across all of them, more easily open source tests, share test coverage across releases ,and run tests as early as possible.
In the coming weeks we’ll be sharing short, bite-sized examples demonstrating tmt usage. With these, new users can get started quickly and existing users won’t miss various interesting and useful features hidden under the hood.
Here we go with the first set of examples showing how to quickly enable a simple smoke test for your component, assuming you are in your project git repository:
sudo dnf install -y tmt
tmt init --template mini
Adjust the example plan to run the desired command:
summary: Basic smoke test
script: foo --version
The very minimal config is really just two lines:
script: make test
Now submit the pull request and wait for the results:
git add .
git checkout -b smoke-test
git commit -m "Enable a simple smoke test"
git push fork -u smoke-test
Eager to learn more? Not patient enough to wait for the results from the CI pipeline? Willing to safely execute tests from your laptop right now? Check the rest of the first chapter of our brand new guide to learn more.
Copyright © 2022 Fedora Community Blog
This work is licensed under a Creative Commons Attribution 4.0 International License.