1
votes

I have implement cucumber protractor example and it works fine ,when I add

resultJsonOutputFile: 'report.json'  

to generate json report ,the report generated just if all steps success but if one step fails the report not generated,Is anyone have any reason why this happen?

protractor.conf file

   exports.config = {
      getPageTimeout: 600000,
      allScriptsTimeout: 700000,
      framework: 'custom',
      frameworkPath: require.resolve('protractor-cucumber-framework'),

      capabilities: {
        'browserName': 'chrome'
      },
      specs: [
        '/home/git/adap_gateway/src/test/features/*.feature'
      ],

      baseURL: 'http://localhost:8099/',

      cucumberOpts: {
        require: '/home/git/adap_gateway/src/test/javascript/stepDef/stepDefinitions.js',
      },
      resultJsonOutputFile: 'report.json'

    }; 

feature file

Feature: Running Cucumber with Protractor

Scenario: Protractor and Cucumber Test
    Given I go to "http://localhost:8099/#/"
    When I add login credential 
    Then I go to scenario home page
    Then I go to scenario details page
    Then I go to edit attack tree page
    Then build attack tree
1
This should not happen, can you please specify the protractor version? - Ram Pasala

1 Answers

1
votes

Put the json output result in to the cucumberOpts.

try something like this:

cucumberOpts: {
    strict: true,    
    format: 'json:reports/current/cucumber_report.json', 
    'format-options': '{"colorsEnabled": true }',
    require: [
        'features/step_definitions/*.js', 
        'features/step_definitions/shared/*.js', 
        'support/*.js'
    ],
},