瀏覽代碼

Fix #41: Wasn't properly accounting for run structure in plans

George S. Baugh 10 年之前
父節點
當前提交
7990769f4e
共有 5 個文件被更改,包括 84 次插入17 次删除
  1. 2 1
      Changes
  2. 56 13
      lib/Test/LWP/UserAgent/TestRailMock.pm
  3. 5 2
      lib/TestRail/API.pm
  4. 1 1
      t/Test-Rail-Parser.t
  5. 20 0
      t/TestRail-API-mockOnly.t

+ 2 - 1
Changes

@@ -1,8 +1,9 @@
 Revision history for Perl module TestRail::API
 
-0.025 2015-05-?? TEODESIAN
+0.025 2015-05-21 TEODESIAN
     - Fix test failures on windows (and an issue in testrail-tests on win32)
     - Fix issue where testrail-tests was unresponsive to --help
+    - Fix issue where getChildRuns would not return all child runs.
 
 0.024 2015-05-17 TEODESIAN
     - Allow spawning of plans in Test::Rail::Parser (and those programs depending on it)

文件差異過大導致無法顯示
+ 56 - 13
lib/Test/LWP/UserAgent/TestRailMock.pm


+ 5 - 2
lib/TestRail/API.pm

@@ -1248,8 +1248,11 @@ sub getChildRuns {
     return 0 unless defined($plan->{'entries'}) && (reftype($plan->{'entries'}) || 'undef') eq 'ARRAY';
     return 0 unless defined($plan->{'entries'}) && (reftype($plan->{'entries'}) || 'undef') eq 'ARRAY';
     my $entries = $plan->{'entries'};
-    my @plans = map { $_->{'runs'}->[0] } @$entries; #XXX not sure if this list-ification is intentional
-    return \@plans;
+    my $plans = [];
+    foreach my $entry (@$entries) {
+        push(@$plans,@{$entry->{'runs'}}) if defined($entry->{'runs'}) && ((reftype($entry->{'runs'}) || 'undef') eq 'ARRAY')
+    }
+    return $plans;
 }
 
 =head2 B<getChildRunByName(plan,name,configurations)>

+ 1 - 1
t/Test-Rail-Parser.t

@@ -255,7 +255,7 @@ $res = exception {
         'browser'             => $browser,
         'run'                 => 'TestingSuite',
         'plan'                => 'mah dubz plan',
-        'configs'             => ['testPlatform1'],
+        'configs'             => ['testConfig'],
         'project'             => 'TestProject',
         'merge'               => 1
     });

+ 20 - 0
t/TestRail-API-mockOnly.t

@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+
+#Test things we can only mock, because the API doesn't support them.
+
+use Test::More 'tests' => 2;
+use TestRail::API;
+use Test::LWP::UserAgent::TestRailMock;
+use Scalar::Util qw{reftype};
+
+my $browser = $Test::LWP::UserAgent::TestRailMock::mockObject;
+my $tr = TestRail::API->new('http://hokum.bogus','fake','fake',1);
+$tr->{'browser'} = $browser;
+$tr->{'debug'} = 0;
+
+my $project = $tr->getProjectByName('TestProject');
+my $plan    = $tr->getPlanByName($project->{'id'},'HooHaaPlan');
+my $runs = $tr->getChildRuns($plan);
+is(reftype($runs),'ARRAY',"getChildRuns returns array");
+is(scalar(@$runs),4,"getChildRuns with multi-configs in the same group returns correct # of runs");

部分文件因文件數量過多而無法顯示