選擇性跑步測試

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
    });
});