如何在TestCafeStudio中重复?

问题描述 投票:0回答:1

我想在 testcafestudio 中重复流程。

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

我想知道以下两件事:

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

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

testing testcafe
1个回答
0
投票

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

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

import from 'testcafe';

function testWrapper (name, cb, repeat = 5) {
    for (let index = 0; index < repeat; index++)
        test(name, cb);
}

fixture('Getting Started')
    .page('https://devexpress.github.io/testcafe/example');

testWrapper('My first test', async t => {
    await t
        .typeText('#developer-name', 'John Smith')
        .click('#submit-button')
        .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
});

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

© www.soinside.com 2019 - 2024. All rights reserved.