浏览代码

Improve error message for step_results

Ryan Sherer 7 年之前
父节点
当前提交
585115e1f5
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      lib/Test/Rail/Parser.pm
  2. 2 0
      t/Test-Rail-Parser.t

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

@@ -333,7 +333,7 @@ sub new {
     #Make sure the step results field passed exists on the system
     my $sr_name = $tropts->{'step_results'};
     $tropts->{'step_results'} = $tr->getTestResultFieldByName($tropts->{'step_results'},$tropts->{'project_id'}) if defined $tropts->{'step_results'};
-    confess("Invalid step results name '$sr_name' passed.") if ref $tropts->{'step_results'} ne 'HASH' && $sr_name;
+    confess("Invalid step results value '$sr_name' passed. Check the spelling and confirm that your project can use the '$sr_name' custom result field.") if ref $tropts->{'step_results'} ne 'HASH' && $sr_name;
 
     $self->{'tr_opts'} = $tropts;
     $self->{'errors'}  = 0;

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

@@ -19,6 +19,7 @@ use Capture::Tiny qw{capture capture_stderr};
 my $apiurl = $ENV{'TESTRAIL_API_URL'};
 my $login  = $ENV{'TESTRAIL_USER'};
 my $pw     = $ENV{'TESTRAIL_PASSWORD'};
+my $step_results = $ENV{'TESTRAIL_STEP_RESULTS'};
 my $is_mock = (!$apiurl && !$login && !$pw);
 
 ($apiurl,$login,$pw) = ('http://testrail.local','teodesian@cpan.org','fake') if $is_mock;
@@ -51,6 +52,7 @@ my $opts = {
     'run'                 => 'TestingSuite',
     'project'             => 'TestProject',
     'merge'               => 1,
+    'step_results'        => $step_results,
 };
 
 my $res = exception { $tap = Test::Rail::Parser->new($opts) };