【问题标题】:Using a single command to run different tests in different modes使用单个命令以不同的模式运行不同的测试
【发布时间】:2021-07-21 16:24:32
【问题描述】:

我有两条命令行:

testcafe firefox ./tests/desktop/*.js
testcafe 'chrome:emulation:device=iphone X' ./tests/mobile/*.js

如何将这两个命令行合并为一个命令行?

例如:

testcafe 'chrome:emulation:device=iphone X' ./tests/mobile/*.js, firefox ./tests/desktop/*.js

【问题讨论】:

    标签: testing automation automated-tests e2e-testing testcafe


    【解决方案1】:

    由于 TestCafe 演示了使用单个命令 herehere 在多个浏览器中运行测试,您可以尝试以下操作:

    testcafe firefox,'chrome:emulation:device=iphone X' ./tests/desktop/*.js
    

    如果您想为不同的浏览器运行不同的测试,您可以为每组测试启动不同的 testcafe 实例/测试会话:

    testcafe firefox ./tests/desktop/*.js & 
    testcafe 'chrome:emulation:device=iphone X' ./tests/mobile/*.js
    

    答案的第二部分包含& 运算符,灵感来自关于parallel test execution with TestCafè provided by BrowserStack 的文档。

    【讨论】:

    • 感谢您的回答。但我需要运行 2 条不同的路径:“./tests/desktop/*.js”在 Firefox 中运行,“./tests/mobile/*.js”在“chrome:emulation:device=iphone X”中运行。是否可以为此编写一个命令行?
    • 你说得对,我在之前版本的答案中忽略了那部分。查看更新版本。
    • 非常感谢。这很有帮助。
    • 很高兴听到它有帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-08
    • 2014-11-23
    • 2021-12-06
    相关资源
    最近更新 更多