0

I'm using the protractor-cucumber framework which comes decoupled from protractor. My protractor version 4.0.9 which got pushed out last night.

My issue: When running protractor in parallel with: protractor protractor.conf.js the generated results JSON file only shows the last test to complete. Basically, that JSON file is overriding itself so our Bamboo cucumber plugin only shows only a single test result when there were multiple test-feature files that did.

For example, if you have 2 tests and your config is set up like this:

//Protractor.conf.js

  multiCapabilities: [{
    'browserName': 'chrome',
    maxInstances: 1,
    shardTestFiles: true,
  }, {
    'browserName': 'chrome',
    shardTestFiles: true,
    maxInstances: 1,
  },],

OR even like this:

  multiCapabilities: [{
    'browserName': 'chrome',
    maxInstances: 2,
    shardTestFiles: true,
  }],

And my cucumberOpts:

cucumberOpts: {
    require: [
      conf.paths.e2e + '/steps/**/*Steps.js',
      conf.paths.e2e + '/hooks.js', 
      conf.paths.e2e + '/env.js',//For Cucumber framework i.e framework: custom
      conf.paths.e2e + '/otherHooks.js',
    ],
    tags: ['~@wip', '~@manual'],
    format: 'pretty',
    //'fail-fast': true
  }

This will pop up 2 chrome instances, but at the end, each instance will generate its own JSON result file instead of a single cumulative json result file.

How can I consolidate the results from all chrome instances that ran in parallel into a single JSON result file so our Bamboo cucumber plugin can display all the tests that ran in parallel and not just the last one which took longer to complete?

Again I want to generate a SINGLE json file with all of the results at the end and NOT many json files, just for clarification; thanks again for looking into this issue which I"m sure a ton of people are struggling with right now.

pelican
  • 5,846
  • 9
  • 43
  • 67

1 Answers1

0

I had a similar problem some time ago and I solve the problem adding timestamp to the JSON file.

Adding this line to Protractor.conf.js

resultJsonOutputFile: 'reports/'+Date.now()+'-protractor-report.json'

  • Thanks for your quick response Adolfo, wouldn't adding the timestamp cause you to have multiple json files? And how would you feed all of those json files to the cucumber plugin? We're using bamboo for our ci pipeline and it expects a single json file in a given location. – pelican Sep 26 '16 at 12:58
  • Yes, you are right. I have multiple json files. Maybe in next releases of protractor cucumber framework they allow multiple results in the same json. https://github.com/mattfritz/protractor-cucumber-framework/issues/46 – Adolfo Luzardo Cabrera Sep 26 '16 at 14:16
  • Thanks again that link you sent points to the exact problem I'm facing. I read different strategies and wondering if you ran into this road block and what your workaround is? I'll try some of the suggestions in that link but I'm also thinking I could achieve this with a gulp task since I do not use grunt and basically collect all json files with that Data.now() appended, then concatenate them all in a way that the json parsers and reporters can understand and display all of the results of the tests. Please let me know how you consolidate your json files when in multicapabilities environment – pelican Sep 26 '16 at 14:38