我有一系列的摩卡测试,其中包括诸如以下的嵌套描述
describe('Tests.', () => {
describe('Test Method 1', () => {
it('should do x', () => {
// test code
});
it('should do y', () => {
// test code
});
});
describe('Test Method 2', () => {
it('should do x', () => {
// test code
});
it('should do y', () => {
// test code
});
});
});
我正在使用mocha-junit-reporter生成看起来像这样的junit.xml
<testsuite name="Root Suite Tests." failures="0" time="0"> </testsuite>
<testsuite name="Root Suite Tests. Test Method 1" failures="0" time="0">
<testcase name="should do x" time="0" classname="Tests. Test Method 1 should do x">
</testcase>
<testcase name="should do y" time="0" classname="Tests. Test Method 1 should do y">
</testcase>
</testsuite>
<testsuite name="Root Suite Tests. Test Method 1" failures="0" time="0">...</testsuite>
<testsuite name="Root Suite Tests. Test Method 2" failures="0" time="0">
<testcase name="should do x" time="0" classname="Tests. Test Method 2 should do x">
</testcase>
<testcase name="should do y" time="0" classname="Tests. Test Method 2 should do y">
</testcase>
</testsuite>
<testsuite name="Root Suite Tests. Test Method 2" failures="0" time="0">...</testsuite>
mocha-junit-reporter的选项是
"useFullSuiteTitle": true,
"testCaseSwitchClassnameAndName": true
使用“测试结果分析器”插件在Jenkins中显示JUnit.xml时,显示如下
测试
Test Method 1 should do x Test Method 1 should do y Test Method 2 should do x Test Method 2 should do y
我希望它像这样显示
测试
Test Method 1 should do x should do y Test Method 2 should do x should do y
这可能吗?如果可能的话,我需要做些什么?