输出所有的失败,而不是一个在TestCafe

问题描述 投票:2回答:2

我怎样才能运行测试时显示所有故障。

test('test case', async (t) => ){
   await t.expect(1).eql(2);
   await t.expect(3).eql(4);
}

我得到什么(第一次失败,然后停止):

1)的AssertionError:预期 '1' 到深等于 '2'

我想(所有错误数据):

1)的AssertionError:预期 '1' 到深等于 '2'

1)的AssertionError:预期 '3' 到深等于 '4'

javascript automated-tests e2e-testing web-testing testcafe
2个回答
4
投票

这将工作,只是把所有的元素数组,并遍历它们

for(let i = 0; i < 400; i++) {
    test
    (`Test `+i, async t => {
        await t.expect(i).eql(i+1);
    });
}

2
投票

真棒,这工作。感谢冰山Stiks)

let x = 0;

for (let i in result1){
    if (result1[i] != result2[i]){
        x += 1;
        console.log( x +') AssertionError: expected ' + result1[i] + ' to deeply equal ' + result2[i] );
    }
}
await t.expect(x).eql(0);
© www.soinside.com 2019 - 2024. All rights reserved.