从红宝石黄瓜输出的JUnit当手柄片状测试(重试破管道)

问题描述 投票:0回答:1

我输出两种格式标志黄瓜测试结果:

--format的JUnit --format AllureCucumber ::格式化

第一个是CICD阶段栅极(100%通过测试在一个环境中部署触发到下一个)。二是输出HTML的仪表板。

我还使用标志:--retry 2因为一对夫妇的我的测试是片状(可能失败一次,但各地通过第二次)。

倾城格式处理reties优雅。问题是,JUnit的格式化XML处理片状测试为失败。

有一种解决方法告诉XML注册0失败,如果所有的测试最终通过?

我发现引用这个问题here。 纵观this threadthis thread,和JUnit的文档,我不认为重试/片状GET占了,我可能需要修补红宝石黄瓜宝石的格式化输出JUnit的时候忽略了第一次失败。

谢谢

ruby junit cucumber allure
1个回答
0
投票

我的快速和肮脏的补丁现在是修补JUnit的格式只递增故障计数像下面。这仅适用于单个重试。当我有更多的时间,我会看看是否有可以进行检查,以了解是否有剩余为测试条件下重试的变量。

def build_testcase(result, scenario_designation, output, test_case)
  duration = Cucumber::Formatter::ResultBuilder.new(result).test_case_duration
  @current_feature_data[:time] += duration
  classname = @current_feature_data[:feature].name
  name = scenario_designation

  @current_feature_data[:builder].testcase(:classname => classname, :name => name, :time => format('%.6f', duration)) do
    if !result.passed? && result.ok?(@config.strict)
      @current_feature_data[:builder].skipped
      @current_feature_data[:skipped] += 1
    elsif !result.passed? && !same_feature_as_previous_test_case?(test_case.feature)
      status = result.to_sym
      exception = get_backtrace_object(result)
      @current_feature_data[:builder].failure(:message => "#{status} #{name}", :type => status) do
        @current_feature_data[:builder].cdata! output
        @current_feature_data[:builder].cdata!(format_exception(exception)) if exception
      end
      @current_feature_data[:failures] += 1 
    end
    @current_feature_data[:builder].tag!('system-out') do
      @current_feature_data[:builder].cdata! strip_control_chars(@interceptedout.buffer_string)
    end
    @current_feature_data[:builder].tag!('system-err') do
      @current_feature_data[:builder].cdata! strip_control_chars(@interceptederr.buffer_string)
    end
  end
  @current_feature_data[:tests] += 1
end
© www.soinside.com 2019 - 2024. All rights reserved.