teemtee / tmt

Test Management Tool
MIT License
80 stars 121 forks source link

Add support for user defined test templates #367

Closed sopos closed 9 months ago

sopos commented 3 years ago

tmt tests create should be able to use user defined templates similarly to beaker-wizard -s template_name where the template is defined in the ~/.beaker_client/wizard

It should be possible to provide a template for the test code and the metadata as well, e.g. some basic set of require.

lukaszachy commented 2 years ago

Raising priority - for existing users of beaker-wizard it is easier to first run wizard and then import to tmt. Missing custom templates is not good for tmt.

Doing cp -r <old test> <new> another way to get "templates". But it would be great if tmt could to that on its own (including adding virtual cases).

sopos commented 2 years ago

I used to use beaker-wizard because it was able to fill most of the data out of a BZ. Now I simply copy existing test and change things. If the template was just static without any automatic data gathering from BZ/Jira/whatever I would stick with copying old test I think.

psss commented 1 year ago

This is one of the blockers to provide a comfortable & concise way to create new tests, blocking TT-242. Let's try to implement in 1.28.

thrix commented 10 months ago

@sopos what do you think, could you maybe contribute with this one.

Seems @psss and @lukaszachy have some ideas how it could be done reasonably.

lukaszachy commented 10 months ago

Would be nice if there could be several test cases created from single template. As I create tests for python (which exists as several, parallel installable components) I need to create several test cases. So my workflow at the moment is to have directory with skeleton files (test.sh, main.fmf, python3.fmf, python311.fmf ...) I copy to newly created test directory.

happz commented 10 months ago

Aaand one note from me, it'd be nice to use Jinja templates for templates, rather than having them hardcoded in tmt.templates. We can bundle the whole directory structure into tmt package, we can have subdirectories for various types of plans/tests and their skeleton files, etc.

psss commented 9 months ago

Forwarding an idea from @kkaarreell:

If I may, I think it would be nice to support loading template from URL. A team could store component specific template in a test repository, ensuring it is always up to date.

Sounds like a useful feature to me.