protractor Getting started with protractor Selective Running Tests


Example

Protractor can selectively run groups of tests using fdescribe() instead of 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 can selectively run tests within groups using fit() instead of it().

describe('first group',()=>{
    fit('only this test will run',()=>{
        //code that will run
    });
    it('this code will not run',()=>{
        //code that won't run
    });
});

If there is no fit() within an fdescribe(), then every it() will run. However, a fit() will block it() calls within the same describe() or fdescribe().

fdescribe('first group',()=>{
    fit('only this test will run',()=>{
        //code that will run
    });
    it('this code will not run',()=>{
        //code that won't run
    });
});

Even if a fit() is in a describe() instead of an fdescribe(), it will run. Also, any it() within an fdescribe() that does not contain a fit() will run.

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