【发布时间】:2018-07-31 14:34:58
【问题描述】:
我正在开发一个使用 webdriverIO 和 mocha 的框架。最近我安装了 Allure 报告器来使用 jenkins 生成 HTML 报告
不过,我遇到了跳过测试的问题。我有很多测试由一个没有任何代码的标题组成,仍然需要编写。 在 mocha 中,我添加“it.skip”以跳过这些测试。 跳过测试时,Allure 报告仅识别每个文件 1 个跳过的测试。
运行以下代码时,Allure 返回 1 个通过测试、1 个失败测试和 1 个跳过测试
describe('Allure test', function() {
it.skip('1. this is a skipped test without any code', function () {
})
it.skip('2. this is another skipped test without any code', function () {
});
it('3. this is an enabled test that has a successfull assert', function () {
chai.expect("foo", "foo should equal foo").to.contain("foo")
});
it('4. this is an enabled test that has a failed assert', function () {
chai.expect("foo", "foo should equal foo").to.contain("bar")
});
});
我真的希望我的魅力报告显示跳过了多少测试,以便能够显示还剩下多少工作。
默认的 mocha 日志可以很好地处理这个问题,它会显示:
Number of specs: 1
1 passing (4.00s)
2 skipped
1 failing
我也使用 wdio spec 报告器,它显示它是这样的,这也很好:
1 passing (2s)
2 pending
1 failing
我尝试使用 categories.json 文件来操作 Allure 类别,但我无法更改任何内容。 我尝试将此作为测试,但将其添加到我的魅力结果文件夹中没有任何改变:
[
{
"name": "Ignored tests",
"matchedStatuses": ["skipped", "Skipped", "pending", "Pending", "failed", "Failed", "broken", "Broken", "skip", "Skip", "failing", "Failing", "passes", "Passes"]
}
]
我使用的工具和版本是:
`-- wdio-mocha-framework@0.6.2
`-- wdio-allure-reporter@0.6.3
`-- webdriverio@4.13.1
谁能告诉我如何让 Allure 看到所有跳过的测试?
【问题讨论】:
标签: mocha.js webdriver-io allure