Protractor: Data driven testing

We can iterate jasmine "it" blocks with custom data easily by passing  some array or some other external objects as follows:


var testParams = testConfig.testArray;

testParams.map(function(testSpec) {
    it('write your test here', function() {
        //test code here
    });
});

Here we are using javascript map function without using any foreach loops as map function internally iterates over the passed array values the given "it"  block.

Comments