Testing 当夹具出现故障时重新启动

Testing 当夹具出现故障时重新启动,testing,automated-tests,e2e-testing,testcafe,web-testing,Testing,Automated Tests,E2e Testing,Testcafe,Web Testing,我写了一个测试,95%的时间通过,其余5%的时间不通过。我仍然不知道为什么会失败(我的猜测是组件渲染不正确) 我实现了一个页面重新加载调用来重新加载页面并重试,但这不是很可靠 如果夹具出现故障,重启夹具的最佳方法是什么? 下面是一个示例测试,它故意无法模拟我的选择器,该选择器大部分时间都在工作,但有时会失败 import { Selector } from 'testcafe'; const URL = 'https://www.youtube.com/watch?v=RWQtB6Xv01Q'

我写了一个测试,95%的时间通过,其余5%的时间不通过。我仍然不知道为什么会失败(我的猜测是组件渲染不正确)

我实现了一个页面重新加载调用来重新加载页面并重试,但这不是很可靠

如果夹具出现故障,重启夹具的最佳方法是什么?

下面是一个示例测试,它故意无法模拟我的选择器,该选择器大部分时间都在工作,但有时会失败

import { Selector } from 'testcafe';

const URL = 'https://www.youtube.com/watch?v=RWQtB6Xv01Q';

fixture `Portal Experience playback`
  .page `${URL}`;

test('Testing YouTube', async t => {
  await t.click(Selector('.wrong-selector')); // to emulate my unstable test
});
导致

✖ Testing YouTube

   1) The specified selector does not match any element in the DOM tree.
是否可以将测试置于for循环中,并在测试通过时使其脱离循环?用于此目的。在这种模式下,TestCaFe将重新启动一个失败的测试,直到它通过或失败3次,并认为只有3次失败才失败。获取有关本文中隔离模式的更多详细信息: