2

This may sound duplicate but it is not.

I know that I can use the below configuration in config file and start multiple instance of the chrome driver that would run the features in parallel that share the step definitions.

  capabilities: {
  'browserName': 'chrome',    
  'shardTestFiles': true,
  'maxInstances': 0
  },

Q1. But my question is around why the chromedriver doesn't exit when a scenario fails?(That happens only when I use value of maxInstance > 0 ). The chromedriver exit with exitcode- 3 and exitcode- 1.

Q2. Is anyone able to sort out the reporting issue? How can I generate the report when all the features have finished?

Any sort of help will be appreciated?

Thanks

Galileo123
  • 185
  • 4
  • 17
  • `protractor-cucumber-framework` [doesn't seem to support](https://github.com/protractor-cucumber-framework/protractor-cucumber-framework/pull/25) reporting when you're running in the sharded mode. To solve this problem, replace `protractor-cucumber-framework` with `serenity-js` which has this functionality. More info in [this answer](http://stackoverflow.com/questions/34821016/is-there-a-protractor-reporting-tool-that-works-with-a-cucumber-framework/42598696#42598696). – Jan Molak Mar 04 '17 at 17:11

2 Answers2

1

In order to generate the consolidated html report after parallel run,I have used afterLaunch parameter in the protractor.conf.js file and have used https://github.com/gkushang/cucumber-html-reporter. Below is the code-

afterLaunch: function afterLaunch () {
   var cucumberHtmlReporter = require('cucumber-html-reporter');
   var jsonReportFolder = '/path/to/all/json/reports';
   var cucumberhtmlReport = path.join(jsonReportFolder, cucumber.html');
   var options = {
        theme: 'bootstrap',
        jsonDir: jsonReportFolder,
        output: cucumberhtmlReport,
        reportSuiteAsScenarios: true,
        launchReport: true
    };

    cucumberHtmlReporter.generate(options);

}
Galileo123
  • 185
  • 4
  • 17
0

The existing behavior is correct.Do not use 'maxInstances': 0 The default value is 1 and any value>1 is the right way to do it. The error that you are seeing is because thats how the source code - taskScheduler

They are handling shard tests in this taskScheduler exports and logic of maxinstances is as below

this.maxInstance = capabilities.maxInstances || 1;
 /**
 * Get maximum number of concurrent tasks required/permitted.
 *
 * @return {number}
 */
 count += Math.min(queue.maxInstance, queue.specLists.length);

So if you have maxInstances 0, It will cause problems and your code will never exit cleanly. Also I dont think your code will run in parallel

What I would suggest is

  1. Check your protractor version and update to latest

  2. Change your config file to - 'maxInstances': 3 //anything greater than 1. 1 is default

AdityaReddy
  • 3,625
  • 12
  • 25
  • It seems that there is no native support for cucumber post protractor version 2.5. It has support for custom framework and cucumber framework has to be "protractor-cucumber-framework". I did change the 'maxInstances' = 1. But I am back to square. Is there a reason that chromedriver exit when scenario fails ? – Galileo123 Oct 09 '16 at 20:16