【问题标题】:Protractor Mocha-Allure-Reporter : Only the first "expect" failure for a testcase is logged in the reportProtractor Mocha-Allure-Reporter :报告中仅记录测试用例的第一个“预期”失败
【发布时间】:2016-04-20 08:34:16
【问题描述】:

我正在使用量角器和 mocha-allure 记者。 在测试中,当有多个“expect”语句时,报告中只记录第一个“expect”语句的结果。请在下面找到示例代码

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;

describe('Allure report for multiple expect', function() {

 it('Check Allure', function(done) {
    expect("first checkpoint").to.equal("is displayed")
    expect("second checkpoint").to.equal("is not displayed")
    expect("third checkpoint").to.equal("is not displayed")
});      

})     

诱惑报告只显示第一次失败 Allure Report Screenshot

我需要测试用例中所有期望语句的所有失败。 有什么办法可以实现吗?

谢谢!!

【问题讨论】:

    标签: protractor mocha.js chai allure chai-as-promised


    【解决方案1】:

    简短回答:是的,但只能针对每个期望使用自己的测试用例。

    长答案: 每次测试只有一个期望值始终是一种很好的模式 - 因为失败的测试应该准确地告诉您出了什么问题。在一个测试用例中拥有多个期望只有在它们以某种方式属于一起时才有用 - 这意味着如果一个失败,那一刻你不会对其他失败的那一刻感兴趣,因为无论如何它们都有一个共同的失败原因(你需要解决)。

    所以我对你的建议是把它们分成三个测试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-30
      • 1970-01-01
      • 1970-01-01
      • 2013-06-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多