网站域名所有权证书,网站设计 分辨率,上海天华建筑设计有限公司地址,app 展示网站.skip() 和 .only() 的使用
说明
在做自动化测试中#xff0c;跳过执行某些测试用例#xff0c;或只运行某些指定的测试用例#xff0c;这种情况是很常见的Cypress中也提供了这种功能
如何跳过测试用例
通过describe.skip() 或者 context.skip() 来跳过不需要执行的测试….skip() 和 .only() 的使用
说明
在做自动化测试中跳过执行某些测试用例或只运行某些指定的测试用例这种情况是很常见的Cypress中也提供了这种功能
如何跳过测试用例
通过describe.skip() 或者 context.skip() 来跳过不需要执行的测试套件
describe(ship test,(){describe.skip(跳过该测试套件,(){it(测试1,(){cy.log(测试用例1被执行);})})
})通过 it.skip() 来跳过不需要执行的测试用例
it.skip(测试用例2,(){cy.log(测试用例2);
});指定执行测试套件或测试用例
当存在 .only() 指定某个测试套件或测试用例时只有这个测试套件或测试用例会被执行其他未加 .only() 的测试套件或测试用例都不会执行
通过 describe.only() 或者 context.only()来指定需要执行的测试套件
测试代码
describe(only suite,(){context(suite1,(){it(case1,(){cy.log(case1);})it(case2,(){cy.log(case2);})})context.only(suite2,(){it(case3,(){cy.log(case3);})it(case4,(){cy.log(case4);})})context(suite3,(){it(case5,(){cy.log(case5);})it(case6,(){cy.log(case6);})})
})通过 it.only() 来指定需要执行的测试用例
describe(only suite,(){it.only(only case1,(){cy.log(case1);})it.only(only case2,(){cy.log(case2);})it(case3,(){cy.log(case3);})
})