Execute two (or more) protractor scripts with different features & specs in paralell
See original GitHub issueI have several tests that make a regression test set. The tests are not dependent from each other, but they take a long time to execute sequentially. I thought I could execute them in parallel, probably in 2 or 3 threads or instances.
Spec files are protractor-cucumber-jscript and features are gherkin.
Is this possible to set up using the protractor configuration file?
I tried the following, unsuccessfully:
var featsLocation = 'features/';
var stepsLocation = 'steps/';
exports.config = {
rootElement: 'html',
chromeDriver: './srv/build/applications/chromedriver/chromedriver_win32/chromedriver.exe',
seleniumServerJar: './node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone.jar',
params:{
authURL:'',
login:{
email:'',
passw:''
}
},
resultJsonOutputFile:'',
getPageTimeout: 60000,
allScriptsTimeout: 60000,
maxSessions: 2,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
multiCapabilities:[
{
browserName: 'chrome',
chromeOptions:{
args:["--headless"]
},
name: 'CAPABILITY_1',
logName: 'LOGNAME1_USERNAME1_A',
shardTestFiles: false,
maxInstances: 1,
count: 1,
specs: [ featsLocation+'authenticateCSM.feature'
, featsLocation+'locationSearch.feature'
]
},{
browserName: 'chrome',
chromeOptions:{
args:["--headless"]
},
name: 'CAPABILITY_2',
logName: 'LOGNAME1_USERNAME2_B',
shardTestFiles: false,
maxInstances: 1,
count: 1,
specs: [ featsLocation+'authenticateCSM.feature'
, featsLocation+'shipmentErrors.feature'
]
}],
onPrepare: function(){
global.EC = protractor.ExpectedConditions;
},
baseUrl: '',
cucumberOpts: {
tags: '',
require: [
'./support/*.js'
, stepsLocation+'shipmentErrors/shipmentErrors.spec.js'
, stepsLocation+'locationSearch/locationSearch.spec.js'
],
monochrome: true,
strict: true,
plugin: "json"
},
};
URL and other parameters are passed using package.json.
When executed, I do get tow instances of the selenium driver each one executing a cucumber feature, but then I get a warning message telling me that the *.spec.js files are not defined, but they are placed as it’s defined in the cucumberOptions section of the config file.
Right HERE ----> steps/shipmentErrors/shipmentErrors.spec.js
and HERE ------> steps/locationSearch/locationSearch.spec.js
.
This is the warning message:
[LOGNAME1_USERNAME1_A] Warnings: [LOGNAME1_USERNAME1_A] [LOGNAME1_USERNAME1_A] 1) Scenario: CSM FinalMile: Get authenticated to test Werner CSM Finalmile (SMOKE) - features\authenticateCSM.feature:11 [LOGNAME1_USERNAME1_A] Step: Given CSM FinalMile: Navigate to the Werner SSO initial page - features\authenticateCSM.feature:12 [LOGNAME1_USERNAME1_A] Message: [LOGNAME1_USERNAME1_A] Undefined. Implement with the following snippet: [LOGNAME1_USERNAME1_A] [LOGNAME1_USERNAME1_A] Given(‘CSM FinalMile: Navigate to the Werner SSO initial page’, function (callback) { [LOGNAME1_USERNAME1_A] // Write code here that turns the phrase above into concrete actions [LOGNAME1_USERNAME1_A] callback(null, ‘pending’); [LOGNAME1_USERNAME1_A] });
Is there something I’m doing wrong with the config file syntax… any clues how I should build it?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Currently there is no way to execute tests in parallel in only two instances of web browser. I have created an Pull Request that solves this issue. https://github.com/angular/protractor/pull/4836. To enable this feature you have to create custom spec scheduler and add it to the configuration. Here is an example:
Did you try to run tests from my example? For me all works as expected. Concerning your errors, it seems that there are problems with paths. You can use glob to specify spec file path.