소스 검색

Fix #43 - Always record raw results when not in case_per_ok or step_results

George S. Baugh 10 년 전
부모
커밋
bcdaef75e7
3개의 변경된 파일18개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      Changes
  2. 6 0
      lib/Test/Rail/Parser.pm
  3. 11 1
      t/Test-Rail-Parser.t

+ 1 - 0
Changes

@@ -2,6 +2,7 @@ Revision history for Perl module TestRail::API
 
 0.026 2015-06-?? TEODESIAN
     - Add --no-match option to testrail-tests to find orphan tests in a tree
+    - Upload full raw results to TestRail when not in step_results or case_per_ok mode
 
 0.025 2015-05-21 TEODESIAN
     - Fix test failures on windows (and an issue in testrail-tests on win32)

+ 6 - 0
lib/Test/Rail/Parser.pm

@@ -233,6 +233,7 @@ sub new {
     $self->{'errors'}  = 0;
     #Start the shot clock
     $self->{'starttime'} = time();
+    $self->{'raw_output'} = "";
 
     return $self;
 }
@@ -251,6 +252,7 @@ sub unknownCallback {
     my (@args) = @_;
     our $self;
     my $line = $args[0]->as_string;
+    $self->{'raw_output'} .= "$line\n" if !$self->{'tr_opts'}->{'step_results'};
 
     #try to pick out the filename if we are running this on TAP in files
 
@@ -279,6 +281,7 @@ sub commentCallback {
     my (@args) = @_;
     our $self;
     my $line = $args[0]->as_string;
+    $self->{'raw_output'} .= "$line\n" if !$self->{'tr_opts'}->{'step_results'};
 
     if ($line =~ m/^#TESTDESC:\s*/) {
         $self->{'tr_opts'}->{'test_desc'} = $line;
@@ -327,6 +330,8 @@ sub testCallback {
 
     #Default assumption is that case name is step text (case_per_ok), unless...
     my $line = $test->as_string;
+    $self->{'raw_output'} .= "$line\n" if !$self->{'tr_opts'}->{'step_results'};
+
     $line =~ s/^(ok|not ok)\s[0-9]*\s-\s//g;
     my $test_name  = $line;
     my $run_id     = $self->{'tr_opts'}->{'run_id'};
@@ -429,6 +434,7 @@ sub EOFCallback {
 
     #Optional args
     my $notes          = $self->{'tr_opts'}->{'test_notes'};
+    $notes = $self->{'raw_output'} if !$self->{'tr_opts'}->{'step_results'};
     my $options        = $self->{'tr_opts'}->{'result_options'};
     my $custom_options = $self->{'tr_opts'}->{'result_custom_options'};
 

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

@@ -7,7 +7,7 @@ use Scalar::Util qw{reftype};
 use TestRail::API;
 use Test::LWP::UserAgent::TestRailMock;
 use Test::Rail::Parser;
-use Test::More 'tests' => 40;
+use Test::More 'tests' => 41;
 use Test::Fatal qw{exception};
 
 #Same song and dance as in TestRail-API.t
@@ -82,6 +82,16 @@ if (!$res) {
     is($tap->{'errors'},0,"No errors encountered uploading case results");
 }
 
+$fcontents = "ok 1 - STORAGE TANKS SEARED
+# whee
+not ok 2 - NOT SO SEARED AFTER ARR
+
+#   Failed test 'NOT SO SEARED AFTER ARR'
+#   at t/fake.test line 10.
+# Looks like you failed 1 test of 2.
+";
+is($tap->{'raw_output'},$fcontents,"Full raw content uploaded in non step results mode");
+
 #Check that time run is being uploaded
 my $timeResults = $tap->{'tr_opts'}->{'testrail'}->getTestResults(1);
 if ( ( reftype($timeResults) || 'undef') eq 'ARRAY') {