运行使用配置文件设置的测试用例

时间:2019-05-06 08:48:51

标签: configuration automated-tests e2e-testing web-testing testcafe

我正在命令提示符下运行Testcases(打字稿文件),并且那里仅提供浏览器选择和并发号之类的设置。但是我想使用TestCafe配置文件testcafe.js中提到的通用设置。 有人可以帮我提供示例testcafe配置文件,以及如何执行测试用例以使用配置文件中提到的设置。

const createTestCafe = require('testcafe');

createTestCafe('localhost', 1337,1338)
.then(tc=>{
    testcafe= tc;
    const runner=testcafe.createRunner();
    return runner
      .browsers(['chrome'])
      .concurrency(3)
      .run();
});

1 个答案:

答案 0 :(得分:1)

在具有测试脚本的目录中创建.testcaferc.json配置文件。 TestCafe将找到配置文件并自动使用它。您不必在编程界面中指定它。

我建议您参考Configuration File主题,其中描述了其选项。您可以在GitHub repository中找到完整的配置文件示例。

相关问题