0
votes

I am using protractor-cucumber framework(protractor 5.2.2 and cucumber 3.2.0).I need to enter some data for multiple users into our application.I am running my protractor script by distributed test execution by selenium grid2(selenium-server-standalone-3.14.0.jar). So that i am able run my script in 5 nodes(each node having only one browser setup).The multiCapabilities when i am running with single user is given below.

multiCapabilities: [
{
browserName: 'chrome',
BatchNo:1
},
{
browserName: 'firefox',
BatchNo:2
},
{
browserName: 'internet explorer',
BatchNo:3
},
{
browserName: 'chrome',
BatchNo:4
},
{
browserName: 'firefox',
BatchNo:5
},
],

My aim is to run with multiple users.so that after processing first user data in all 5 nodes, i have to process next user data.i have a array of user id

var userid=[1500,1501,1502]

So can i use a loop inside multiCapabilities and pass userid to each object of multiCapabilities. What i need is, if i have given userid in each object of the multiCapabilities,then first userid request should pass to the all 5 nodes and those 5 nodes should process the data of first user, after completing the first user, then next userid request should pass to the all 5 nodes and those 5 nodes should process the data of the second user and so on.But my understanding is once we set the multiCapabilities, then we cannot reset it after giving the command "protractor conf.js" .So how can i do this?Thanks in advance.

1
Protractor not support to do that natively. Either capabilites or multiCapabilities only be loaded for once time when Protractor read the conf.js. Why you don't try following process for each test case: open logout url -> open login url -> input vary userid & pwd -> do case scenario steps. Put the process in a loop of userid array.yong
Thanks for your reply..As per the requirement, i need to execute first user data in all threads/browsers/nodes, then after completion of first user, i need to execute next user data in all threads/browsers/nodes and so on.Devleena

1 Answers

0
votes

You should make loop inside your test files instead of your configuration file. Take a look at DataProvider some implementations.