2014-11-04 107 views
2

我正在使用如何设置测试状态中测试单元成功

gem 'test-unit' 

Github上链接了一个试验:https://github.com/test-unit/test-unit

以及使用

gem 'ci_reporter' 

Github上Link报告:https://github.com/ci-reporter/ci_reporter

Class Sample 

    def test_sample 
    # code 
    notify "Notification message" 
    end 
end 

测试单元宝石具有以下状态:

pending 
omission 
notification 
pass 
error 
failure 

的C记者宝石有以下状态:

Success 
Failure 

我正在使用测试单元通知状态进行了抽样检测。

使用ci-reporter gem生成报告时,它会显示具有故障状态的通知消息。

附参考Notification

我需要证明与通知信息中的成功状态报告。怎么做?

+0

您是否尝试过在通知后返回'0'或'1'? – Bala 2014-11-04 09:15:49

+0

@Bala是试过了。但没有工作。 – karan 2014-11-04 10:04:56

回答

0

@karan要清楚它是你想要影响CI报告xml报告的输出,而不是测试的失败/传递状态?如果您致电Kernel.exit 1失败,并且成功时不做任何事情(或Kernel.exit 0),则应该处理通过/失败状态,但是如果CI记者无法最好地捕获您的州以检查其文档或在此处打开问题,则无法工作。但是,如果你只是有一个方法返回0或1,他们调用Kernel.exit如上所述,我在我的debt_ceiling gem for ci集成中做到了这一点,它在那里工作得很好。