George S. Baugh 11 лет назад
Родитель
Сommit
cc7a24325a

+ 3 - 0
dist.ini

@@ -84,6 +84,8 @@ stopwords = getTestSuiteByName
 stopwords = getTestSuites
 stopwords = getTests
 stopwords = getUsers
+stopwords = getChildRunByName
+stopwords = getChildRuns
 stopwords = stepResult
 stopwords = testsuites
 stopwords = api
@@ -97,6 +99,7 @@ stopwords = testCallback
 stopwords = unknownCallback
 stopwords = buildStepResults
 stopwords = testrailrc
+stopwords = TODO
 
 [PkgVersion]
 [AutoPrereqs]

BIN
dist/TestRail-API-0.014.tar.gz


+ 2 - 4
lib/App/Prove/Plugin/TestRail.pm

@@ -48,11 +48,9 @@ Not the most elegant solution, but I see no other clear path to get those variab
 sub load {
     my ($class, $p) = @_;
 
-    my ($apiurl,$password,$user,$project,$run,$case_per_ok,$step_results) = _parseConfig();
-
     my $app = $p->{app_prove};
     my $args = $p->{'args'};
-    my $params = {};
+    my $params = _parseConfig();
 
     my @kvp = ();
     my ($key,$value);
@@ -99,7 +97,7 @@ sub _parseConfig {
         $results->{lc($arr->[0])} = $arr->[1];
     }
     close($fh);
-    return ($results->{'apiurl'},$results->{'password'},$results->{'user'},$results->{'project'},$results->{'run'},$results->{'case_per_ok'},$results->{'step_results'});
+    return $results;
 }
 
 1;

+ 2 - 1
lib/Test/Rail/Harness.pm

@@ -39,6 +39,7 @@ Picks the arguments passed to App::Prove::Plugin::TestRail out of $ENV and shutt
 sub make_parser {
     my ($self, $job) = @_;
     my $args = $self->SUPER::_get_parser_args($job);
+    my @configs = ();
 
     #XXX again, don't see any way of getting this downrange to my parser :(
     $args->{'apiurl'}  = $ENV{'TESTRAIL_APIURL'};
@@ -47,7 +48,7 @@ sub make_parser {
     $args->{'project'} = $ENV{'TESTRAIL_PROJ'};
     $args->{'run'}     = $ENV{'TESTRAIL_RUN'};
     $args->{'plan'}    = $ENV{'TESTRAIL_PLAN'};
-    my @configs =  split(/:/,$ENV{'TESTRAIL_CONFIGS'}) if $ENV{'TESTRAIL_CONFIGS'};
+    @configs = split(/:/,$ENV{'TESTRAIL_CONFIGS'}) if $ENV{'TESTRAIL_CONFIGS'};
     $args->{'configs'} = \@configs;
     $args->{'result_options'} = {'version' => $ENV{'TESTRAIL_VERSION'}} if $ENV{'TESTRAIL_VERSION'};
     $args->{'case_per_ok'}    = $ENV{'TESTRAIL_CASEOK'};

+ 5 - 5
lib/TestRail/API.pm

@@ -1122,7 +1122,7 @@ Extract the child runs from a plan.  Convenient, as the structure of this hash i
 
 =back
 
-Returns ARRAYREF of run definition HASHREFs.  Returns undef upon failure to extract the data.
+Returns ARRAYREF of run definition HASHREFs.  Returns 0 upon failure to extract the data.
 
 =cut
 
@@ -1130,8 +1130,8 @@ sub getChildRuns {
     my ($self,$plan) = @_;
     confess("Object methods must be called by an instance") unless ref($self);
     confess("Plan must be HASHREF") unless defined($plan) && (reftype($plan) || 'undef') eq 'HASH';
-    return undef unless defined($plan->{'entries'}) && (reftype($plan->{'entries'}) || 'undef') eq 'ARRAY';
-    return undef unless defined($plan->{'entries'}->[0]->{'runs'}) && (reftype($plan->{'entries'}->[0]->{'runs'}) || 'undef') eq 'ARRAY';
+    return 0 unless defined($plan->{'entries'}) && (reftype($plan->{'entries'}) || 'undef') eq 'ARRAY';
+    return 0 unless defined($plan->{'entries'}->[0]->{'runs'}) && (reftype($plan->{'entries'}->[0]->{'runs'}) || 'undef') eq 'ARRAY';
     return $plan->{'entries'}->[0]->{'runs'};
 }
 
@@ -1159,14 +1159,14 @@ sub getChildRunByName {
     confess("Run name must be STRING") unless $self->_checkString($name);
     confess("Configurations must be ARRAYREF") unless !defined($configurations) || (reftype($configurations) || 'undef') eq 'ARRAY';
     my $runs = $self->getChildRuns($plan);
-    return 0 if !defined($runs);
+    return 0 if !$runs;
 
     my @pconfigs = ();
 
     #Figure out desired config IDs
     if (defined $configurations) {
         my $avail_configs = $self->getConfigurations($plan->{'project_id'});
-        my ($cname,$cid,@rconfigs);
+        my ($cname);
         @pconfigs = map {$_->{'id'}} grep { $cname = $_->{'name'}; grep {$_ eq $cname} @$configurations } @$avail_configs; #Get a list of IDs from the names passed
     }
     foreach my $run (@$runs) {

+ 1 - 1
t/TestRail-API.t

@@ -119,7 +119,7 @@ is($tr->getPlanByID($new_plan->{'id'})->{'id'},$new_plan->{'id'},"Can get plan b
 my $prun = $new_plan->{'entries'}->[0]->{'runs'}->[0];
 is($tr->getRunByID($prun->{'id'})->{'name'},"Executing the great plan","Can get child run of plan by ID");
 is($tr->getChildRunByName($new_plan,"Executing the great plan")->{'id'},$prun->{'id'},"Can find child run of plan by name");
-is($tr->getChildRunByName($namePlan,"Executing the great plan")->{'id'},$prun->{'id'},"Getting run by name returns child runs");
+isnt($tr->getChildRunByName($namePlan,"Executing the great plan")->{'id'},undef,"Getting run by name returns child runs");
 
 #Test TEST/RESULT methods
 my $tests = $tr->getTests($new_run->{'id'});