VerTest supports a markdown syntax to include files as document fragment, based on the Markdown-it-include module.
Unlike the original module, you cannot configure the syntax of the inclusion block, it has to be in the form of:
!!!include([relative path to the included file])!!!When you have common parts across your tests, you can so templatize them. First advantage for you is to increase the maintainability of the tests, avoiding repetitions.
You should not add the fragments to the test suite, so you should exclude the corresponding files in the file selector to keep a clean file tree and avoid unused test cases.
When a modification occurs on such fragment, and if the fragment relates to a test file, VerTest will notify you exactly the same way it does for a modification of a test file (See the GIT modification section).
VerTest will display the resulting diff in a recurse way:
In this example, the file tests/inclusions/simple-content.md has two inclusions:
./inclusions/content-with-inclusion.mdat line 5./inclusions/simple-content.mdat line 11
The file ./inclusions/content-with-inclusion.md also includes ./simple-content.md
on line 3.
So if I add a line in ./inclusions/simple-content.md, the resulting diff indicates that the test
tests/inclusions/simple-content.md has two modification :
- On line 5 via the file
./inclusions/content-with-inclusion.mdthat includes./inclusions/simple-content.mdon line 3 - Directly on line 11 via
./inclusions/simple-content.mdinclusion
The inclusion system is recursive, you can include a fragment that includes another, and so on...
There is no limitation on the type of file you can include, so it is possible to do such powerful tricks:
\`\`\`json
!!!include([relative path to the JSON file])!!!
\`\`\`