NAME
Test::Rail::Parser - Upload your TAP results to TestRail
VERSION
version 0.022
DESCRIPTION
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.
CONSTRUCTOR
new(OPTIONS)
Get the TAP Parser ready to talk to TestRail, and register a bunch of callbacks to upload test results.
- OPTIONS - HASHREF -- Keys are as follows:
-
- apiurl - STRING: Full URI to your TestRail installation.
- user - STRING: Name of your TestRail user.
- pass - STRING: Said user's password.
- debug - BOOLEAN: Print a bunch of extra messages
- browser - OBJECT: Something like an LWP::UserAgent. Useful for mocking with Test::LWP::UserAgent::TestRailMock.
- run - STRING (semi-optional): name of desired run. Required if run_id not passed.
- run_id - INTEGER (semi-optional): ID of desired run. Required if run not passed.
- plan - STRING (semi-optional): Name of test plan to use, if your run provided is a child of said plan. Only relevant when run_id not passed.
- configs - ARRAYREF (optional): Configurations to filter runs in plan by. Runs can have the same name, yet with differing configurations in a plan; this handles that odd case.
- project - STRING (optional): name of project containing your desired run. Required if project_id not passed.
- project_id - INTEGER (optional): ID of project containing your desired run. Required if project not passed.
- step_results - STRING (optional): 'internal name' of the 'step_results' type field available for your project. Mutually exclusive with case_per_ok
- case_per_ok - BOOLEAN (optional): Consider test files to correspond to section names, and test steps (OKs) to correspond to tests in TestRail. Mutually exclusive with step_results.
- result_options - HASHREF (optional): Extra options to set with your result. See TestRail::API's createTestResults function for more information.
- custom_options - HASHREF (optional): Custom options to set with your result. See TestRail::API's createTestResults function for more information. step_results will be set here, if the option is passed.
- spawn - INTEGER (optional): Attempt to create a run based on the provided testsuite identified by the ID passed here. If plan/configs is passed, create it as a child of said plan with the listed configs. If the run exists, use it and disregard the provided testsuite ID.
It is worth noting that if neither step_results or case_per_ok is passed, that the test will be passed if it has no problems of any sort, failed otherwise. 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.
PARSER CALLBACKS
unknownCallback
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.
commentCallback
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.
testCallback
If we are using step_results, append it to the step results array for use at EOF. If we are using case_per_ok, update TestRail per case. Otherwise, do nothing.
EOFCallback
If we are running in step_results mode, send over all the step results to TestRail. If we are running in case_per_ok mode, do nothing. Otherwise, upload the overall results of the test to TestRail.
NOTES
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.
SEE ALSO
SPECIAL THANKS
Thanks to cPanel Inc, for graciously funding the creation of this module.
AUTHOR
George S. Baugh <teodesian@cpan.org>
SOURCE
The development version is on github at http://github.com/teodesian/TestRail-Perl and may be cloned from git://github.com/teodesian/TestRail-Perl.git
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 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.