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

Vishal Aggarwal
5,5832 gold badges20 silver badges37 bronze badges
asked Jan 16, 2019 at 5:02
2
  • Please SHOW your current implementation in code to give clarity and highlight issue in code. Commented Jan 20, 2019 at 10:26
  • I have edited title to make it specific, please feel free to revert back as needed. Commented Jan 20, 2019 at 10:32

1 Answer 1

1

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);
 });
 });
});
answered Jan 20, 2019 at 19:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.