选择性跑步测试
Protractor 可以使用 fdescribe() 而不是 describe() 选择性地运行测试组。
fdescribe('first group',()=>{
it('only this test will run',()=>{
//code that will run
});
});
describe('second group',()=>{
it('this code will not run',()=>{
//code that won't run
});
});
Protractor 可以使用 fit() 而不是它()选择性地在组内运行测试。
describe('first group',()=>{
fit('only this test will run',()=>{
//code that will run
});
it('this code will not run',()=>{
//code that won't run
});
});
如果 fdescribe() 中没有 fit(),则每个 it() 都会运行。但是,fit() 将在同一个 describe() 或 fdescribe()中阻止 it() 调用。
fdescribe('first group',()=>{
fit('only this test will run',()=>{
//code that will run
});
it('this code will not run',()=>{
//code that won't run
});
});
即使 fit() 在 describe()而不是 fdescribe() 中,它也会运行。此外,fdescribe() 中不包含 fit() 的任何 it() 都将运行。
fdescribe('first group',()=>{
it('this test will run',()=>{
//code that will run
});
it('this test will also run',()=>{
//code that will also run
});
});
describe('second group',()=>{
it('this code will not run',()=>{
//code that won't run
});
fit('this code will run',(){
//code that will run
});
});