首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cucumber with Protractor json报表

Cucumber with Protractor json报表
EN

Stack Overflow用户
提问于 2017-05-01 03:48:01
回答 1查看 1.3K关注 0票数 1

我已经实现了黄瓜量角器的例子,它工作良好,当我添加

代码语言:javascript
复制
resultJsonOutputFile: 'report.json'  

为了生成json报告,只有当所有步骤都成功时才会生成报告,但如果其中一个步骤失败,则不会生成报告,有人会有任何原因导致这种情况发生吗?

protractor.conf文件

代码语言:javascript
复制
   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'

    }; 

特征文件

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2018-04-30 17:50:14

将json输出结果放入cucumberOpts。

尝试如下所示:

代码语言:javascript
复制
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'
    ],
},
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43710646

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档