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

Popular posts from this blog

Testing Webservice with SoapUI Having Windows Authentication

Data Driven Testing Using Selenium -WebDriver in Python

How to Re-run Failed Scenarios in Cucumber