1

I am using protractor/js for automating end to end tests for our website. We have a test data set that we have saved in different JS files and we use this data while executing test cases. We are using POM. So, generally the calls to data files are originated from the page files only.

So, here is the issue: We have started creating a suite for component tests which uses page files from the same suite as mentioned above. But the issue is that the component tests require different data for execution.

How can we achieve that when the regression tests are executing, then page files should use different set of data but when component tests are executing, they should use different sets of data. However, calls to the data files will be made from the page files which are common.

Let me know in case you need any more details

  • Please SHOW your current implementation in code to give clarity and highlight issue in code. – Vishal Aggarwal Jan 20 at 10:26
  • I have edited title to make it specific, please feel free to revert back as needed. – Vishal Aggarwal Jan 20 at 10:32
0

Simply store data in json object and iterate it over any function(page object) call:

describe('LoginPage.', function() {
    var loginPage = require('../PageObjects/LoginPage.js');
    var loginData = require('../TestData/json/loginData.json');

    loginData.forEach(function (data) {
        it(data.description, function () {
            loginPage.login(data);
        });
    });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.