|
|
@@ -2,12 +2,79 @@
|
|
|
# ABSTRACT: Upload your TAP results to TestRail after they've finished
|
|
|
# PODNAME: testrail-report
|
|
|
|
|
|
+=head1 SYNOPSIS
|
|
|
+
|
|
|
+ testrail-report [OPTIONS] tapfile
|
|
|
+ prove -v sometest.t > results.tap && testrail-report [OPTIONS] results.tap
|
|
|
+
|
|
|
+ prove -v sometest.t | testrail-report [OPTIONS]
|
|
|
+
|
|
|
+ prove -PTestRail='http://some.testlink.install/,someUser,somePassword,someProject,someRun,0,step_results' sometest.t
|
|
|
+
|
|
|
+=head1 DESCRIPTION
|
|
|
+
|
|
|
+testrail-report - report raw TAP results to a TestRail install
|
|
|
+
|
|
|
+USAGE:
|
|
|
+=head2 PARAMETERS:
|
|
|
+
|
|
|
+=head3 MANDATORY PARAMETERS
|
|
|
+
|
|
|
+ --project [someproject] : associate results (if any) with theprovided project name.
|
|
|
+
|
|
|
+ --run [somerun] : associates results (if any) with the provided run name.
|
|
|
+
|
|
|
+IF none of these options are provided, you will be asked to type
|
|
|
+these in as needed, supposing you are not redirecting input
|
|
|
+(such as piping into this command).
|
|
|
+
|
|
|
+=head3 CONFIG OVERRIDES
|
|
|
+
|
|
|
+In your \$HOME, put a file called .testrailrc with key=value
|
|
|
+syntax separated by newlines. Valid Keys are: apiurl,user,password
|
|
|
+
|
|
|
+=head3 CONFIG OPTIONS
|
|
|
+
|
|
|
+These override the config, if present. If neither are used, you will be prompted.
|
|
|
+
|
|
|
+ --apiurl [url] : full URL to get to TestRail index document
|
|
|
+
|
|
|
+ --password [key] : Your TestRail Password.
|
|
|
+
|
|
|
+ --user [name] : Your TestRail User Name.
|
|
|
+
|
|
|
+=head3 BEHAVIOR
|
|
|
+
|
|
|
+ --case-ok : Whether to consider each OK to correspond to a test in TestRail
|
|
|
+
|
|
|
+ --step-results [name] : 'System Name' of a 'step_results' type field to set for your tests.
|
|
|
+
|
|
|
+These options are mutually exclusive. If neither is set, the
|
|
|
+overall result of the test will be used as the pass/fail for the test.
|
|
|
+
|
|
|
+=head2 PROVE PLUGIN:
|
|
|
+
|
|
|
+passing -PTestRail=apiurl,user,pass,project,run to prove will
|
|
|
+automatically upload your test results while the test is running if
|
|
|
+real-time results are desired.
|
|
|
+
|
|
|
+See L<App::Prove::Plugin::TestRail> for more information.
|
|
|
+
|
|
|
+=head2 REQUIREMENTS:
|
|
|
+
|
|
|
+Your TestRail install must have 3 custom statuses with the internal
|
|
|
+names 'skip', 'todo_pass', and 'todo_fail', to represent those
|
|
|
+states which TAP can have.
|
|
|
+
|
|
|
+=cut
|
|
|
+
|
|
|
use strict;
|
|
|
use warnings;
|
|
|
|
|
|
use Getopt::Long;
|
|
|
use Term::ANSIColor qw(colorstrip);
|
|
|
use Test::Rail::Parser;
|
|
|
+use IO::Interactive::Tiny ();
|
|
|
|
|
|
print "testrail-report\n----------------------\n";
|
|
|
|
|
|
@@ -36,8 +103,6 @@ PARAMETERS:
|
|
|
these in as needed, supposing you are not redirecting input
|
|
|
(such as piping into this command).
|
|
|
|
|
|
- [OPTIONS]
|
|
|
-
|
|
|
[CONFIG OVERRIDES]
|
|
|
In your \$HOME, put a file called .testrailrc with key=value
|
|
|
syntax separated by newlines. Valid Keys are: apiurl,user,password
|
|
|
@@ -65,6 +130,8 @@ PROVE PLUGIN:
|
|
|
automatically upload your test results while the test is running if
|
|
|
real-time results are desired.
|
|
|
|
|
|
+ See App::Prove::Plugin::TestRail for more information.
|
|
|
+
|
|
|
REQUIREMENTS:
|
|
|
Your TestRail install must have 3 custom statuses with the internal
|
|
|
names 'skip', 'todo_pass', and 'todo_fail', to represent those
|
|
|
@@ -136,13 +203,14 @@ if ($file) {
|
|
|
close($fh);
|
|
|
} else {
|
|
|
#Just read STDIN, print help if no file was passed
|
|
|
- if (-t STDIN) { help(); }
|
|
|
+ if (IO::Interactive::Tiny::is_interactive()) { print "ERROR: no file passed, and no data piped in! See --help for usage." }
|
|
|
if ( !$run || !$apiurl || !$password || !$user || !$project ) { print "ERROR: Interactive mode not allowed when piping input. See --help for options.\n"; exit 0;};
|
|
|
while (<>) {
|
|
|
$_ = colorstrip($_); #strip prove brain damage
|
|
|
s/^\s*//g; #Fix prove brain damage
|
|
|
$fcontents .= $_;
|
|
|
}
|
|
|
+ help() if !$fcontents; #Nothing passed to stdin!
|
|
|
}
|
|
|
|
|
|
#Interrogate user if they didn't provide info
|
|
|
@@ -195,3 +263,17 @@ print "Done.\n";
|
|
|
|
|
|
#all done
|
|
|
0;
|
|
|
+
|
|
|
+__END__
|
|
|
+
|
|
|
+=head1 SEE ALSO
|
|
|
+
|
|
|
+L<TestRail::API>
|
|
|
+
|
|
|
+L<App::Prove::Plugin::TestRail>
|
|
|
+
|
|
|
+L<TAP::Parser>
|
|
|
+
|
|
|
+=head1 SPECIAL THANKS
|
|
|
+
|
|
|
+Thanks to cPanel Inc, for graciously funding the creation of this module.
|