Test::Rail::Parser - Upload your TAP results to TestRail
version 0.049
A TAP parser which will upload your test results to a TestRail install. Has several options as to how you might want to upload said results.
Subclass of TAP::Parser, see that for usage past the constructor.
You should probably use App::Prove::Plugin::TestRail or the bundled program testrail-report for day-to-day usage... unless you need to subclass this. In that case a couple of options have been exposed for your convenience.
Get the TAP Parser ready to talk to TestRail, and register a bunch of callbacks to upload test results.
In both this mode and step_results, the file name of the test is expected to correspond to the test name in TestRail.
This module also attempts to calculate the elapsed time to run each test if it is run by a prove plugin rather than on raw TAP.
The constructor will terminate if the statuses 'pass', 'fail', 'retest', 'skip', 'todo_pass', and 'todo_fail' are not registered as result internal names in your TestRail install.
The purpose of the retest status is somewhat special, as there is no way to set a test back to 'untested' in TestRail, and we use this to allow automation to pick back up if something needs re-work for whatever reason.
The global status of the case will be set according to the following rules:
1. If there are no issues whatsoever besides TODO failing tests & skips, mark as PASS 2. If there are any non-skipped or TODOed fails OR a bad plan (extra/missing tests), mark as FAIL 3. If there are only SKIPs (e.g. plan => skip_all), mark as SKIP 4. If the only issues with the test are TODO tests that pass, mark as TODO PASS (to denote these TODOs for removal). 5. If no tests are run at all, and no plan made (such as a compile failure), the cases will be marked as failures unless you provide a test_bad status name in your testrailrc.
Step results will always be whatever status is relevant to the particular step.
A line that begins like so:
% mark_status=
Will allow you to force the status of a test case to whatever is on the right hand side of the = expression.
Example (force test to retest in event of tool failure):
my $failed = do_something_possibly_causing_tool_failure(); print "% mark_status=retest" if $failed;
Bogus statuses will cluck, but otherwise be ignored. Valid statuses are any of the required internal names in your TestRail install (see above).
Multiple instances of this will ignore all but the latest valid status.
Called whenever we encounter an unknown line in TAP. Only useful for prove output, as we might pick a filename out of there. Stores said filename for future use if encountered.
Grabs comments preceding a test so that we can include that as the test's notes. Especially useful when merge=1 is passed to the constructor.
If we are using step_results, append it to the step results array for use at EOF. Otherwise, do nothing.
If bail_out is called, note it and add step results.
If we are running in step_results mode, send over all the step results to TestRail. Otherwise, upload the overall results of the test to TestRail.
Used to record test planning messages.
make_result has been overridden to make the parser object available to callbacks.
When using SKIP: {} (or TODO skip) blocks, you may want to consider naming your skip reasons the same as your test names when running in test_per_ok mode.
TestRail::API
TAP::Parser
Thanks to cPanel Inc, for graciously funding the creation of this module.
George S. Baugh <teodesian@cpan.org>
The development version is on github at https://github.com/teodesian/TestRail-Perl and may be cloned from git://github.com/teodesian/TestRail-Perl.git
This software is copyright (c) 2021 by George S. Baugh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install TestRail::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TestRail::API
CPAN shell
perl -MCPAN -e shell install TestRail::API
For more information on module installation, please visit the detailed CPAN module installation guide.