Protractor-cucumber report: result.json is empty

纵然是瞬间 提交于 2020-04-17 05:44:28

问题


After i follow this question Cucumber HTML report with Protractor to add this line to config file resultJsonOutputFile: 'report.json', i can generate report.json file but this file is empty after i run my test.

---------------conf.js--------------

exports.config = {

    allScriptTimeout: 60000, //To set up a timeout for each test executed on Protractor
    baseUrl: 'http://localhost/wp/index.php',
    seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
    //seleniumServerJar: 'selenium-server-standalone-2.48.2.jar',
    framework: 'cucumber',
    specs: [
        'Feature/login.feature'
    ],
    capabilities: {
        browserName: 'firefox',
    },
    onPrepare   : function () {
       //driver.manage().window().setSize( width, height );
        global.driver = browser.driver;
        browser.ignoreSynchronization = true;
    },
    resultJsonOutputFile: 'report.json',
    cucumberOpts: {
        require: 'Feature/Steps/*_steps.js',
        format: 'pretty',
        defaultTimeoutInterval: 30000
    }
};

Am i doing wrong or missing with my config? Could you help me give a guide to generate report for protractor-cucumber? Thank so much.


回答1:


Changing the following code should solve the issue. (Refresh the folder in IDE to view the report.json)

// resultJsonOutputFile: 'report.json',

cucumberOpts: {  
    require: 'Feature/Steps/*_steps.js',  
    format: 'pretty',  
    format:'json:../report.json'  
}   


来源:https://stackoverflow.com/questions/33495539/protractor-cucumber-report-result-json-is-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!