在Cypress.io中仍然可以控制测试运行吗? [英] In Cypress.io is there anyway to control the test run?
问题描述
集成文件夹下的我的 example-spec.js测试包含15个测试,每次Cypress.io将运行 example-spec.js中编写的所有15个测试时。我想选择并指定哪个测试需要运行,一次可能要进行1或2个测试。原因也许是我不想在添加新测试时等待查看所有测试的输出。有什么方法可以控制Cypress.io中的测试运行?
My 'example-spec.js' tests under the integration folder contain 15 tests, each time the Cypress.io will run all the 15 tests written in the 'example-spec.js'. I would like to choose and specify 'which' test needs to run, maybe 1 or 2 test at a time. The reason maybe I don't want to wait to see the output of all test while adding a 'new' test. Is there any way to control the test run in Cypress.io?
推荐答案
我不知道是否可以通过用户界面执行此操作,但是您可以使用mocha方法通过以下方式仅运行选定的测试:
I don't know if there's way to do it from user interface, but You can use mocha methods to run only chosen tests by:
- 使用要忽略的
xit
测试代替it
- 使用
it.skip
在要忽略的测试上 - 在单个single上使用
it.only
测试您要运行的
- Replacing
it
withxit
tests you want to omit - Using
it.skip
on tests you want to omit - Using
it.only
on single test you want to run
这篇关于在Cypress.io中仍然可以控制测试运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!