Kaynağa Gözat

Fix #136 by adding a plan callback to record test plan

George S. Baugh 8 yıl önce
ebeveyn
işleme
822ae3d46d
3 değiştirilmiş dosya ile 17 ekleme ve 3 silme
  1. 1 1
      Changes
  2. 14 1
      lib/Test/Rail/Parser.pm
  3. 2 1
      t/Test-Rail-Parser.t

+ 1 - 1
Changes

@@ -2,7 +2,7 @@ Revision history for Perl module TestRail::API
 
 0.041 2017-06-XX TEODESIAN
     - Fix MCE usage issue with confusion based on array -> hash inputs in TestRail::Utils::Find
-    
+    - Fix issue where Test plans were not recorded in the raw output of a case.
 
 0.040 2017-05-24 TEODESIAN
     - Fix performance issue in TestRail::Utils::Find::FindTests

+ 14 - 1
lib/Test/Rail/Parser.pm

@@ -130,7 +130,8 @@ sub new {
         'comment' => \&commentCallback,
         'unknown' => \&unknownCallback,
         'bailout' => \&bailoutCallback,
-        'EOF'     => \&EOFCallback
+        'EOF'     => \&EOFCallback,
+        'plan'    => \&planCallback,
     };
 
     my $tropts = {
@@ -564,6 +565,18 @@ sub EOFCallback {
     return $cres;
 }
 
+=head2 planCallback
+
+Used to record test planning messages.
+
+=cut
+
+sub planCallback {
+    my ($plan) = @_;
+    my $self = $plan->{'parser'};
+    $self->{raw_output} .= $plan->as_string;
+}
+
 sub _set_result {
     my ($self,$run_id,$test_name,$status,$notes,$options,$custom_options) = @_;
     my $tc;

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

@@ -10,7 +10,7 @@ use Scalar::Util qw{reftype};
 use TestRail::API;
 use Test::LWP::UserAgent::TestRailMock;
 use Test::Rail::Parser;
-use Test::More 'tests' => 118;
+use Test::More 'tests' => 119;
 use Test::Fatal qw{exception};
 use Test::Deep qw{cmp_deeply};
 use Capture::Tiny qw{capture};
@@ -180,6 +180,7 @@ isa_ok($tap,"Test::Rail::Parser");
 if (!$res) {
     $tap->run();
     is($tap->{'errors'},0,"No errors encountered uploading case results");
+    like( $tap->{raw_output}, qr/cause I can/i, "SKIP_ALL reason recorded"); diag $tap->{raw_output};
     is($tap->{'global_status'},6, "Test global result is SKIP on skip all");
 }