如何在TestCafeStudio中重复?

김철수*_*김철수 2 testing testcafe

我想在 testcafestudio 中重复流程。

如何才能运行10~1000次1flow?

我想知道以下两件事:

  1. 运行页面过载测试
  2. 在同一页面上运行 100 次

似乎无法在 testcafestudio 中重复流程,但我需要这样做,以便重复测试。

小智 6

您可以以 JavaScript 测试文件格式多次重复测试(https://docs.devexpress.com/TestCafeStudio/401052/test-concepts/test-scripts )。还可以以 JavaScript 测试文件格式记录测试。

\n

以下解决方法允许您多次重复测试:

\n

\r\n
\r\n
import from \'testcafe\';\n\nfunction testWrapper (name, cb, repeat = 5) {\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0for (let index = 0; index < repeat; index++)\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0test(name, cb);\n}\n\nfixture(\'Getting Started\')\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0.page(\'https://devexpress.github.io/testcafe/example\');\n\ntestWrapper(\'My first test\', async t => {\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0await t\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0.typeText(\'#developer-name\', \'John Smith\')\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0.click(\'#submit-button\')\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0.expect(Selector(\'#article-header\').innerText).eql(\'Thank you, John Smith!\');\n});
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

如果您在无代码模式下运行测试,则可以执行相同的操作 - 只需首先将测试转换为 JavaScript。

\n