【问题标题】:Html-testrail report in testcafe not coming correcttestcafe 中的 Html-testrail 报告不正确
【发布时间】:2019-10-14 19:48:23
【问题描述】:

我下载了 testcafe-reporter-html-testrail 并在我的 testcafe 项目中使用它。如果我为报告提供自定义名称,则无法正确保存,即报告不完整,几乎为空白,只有几行...但是,如果我没有提供自定义名称,则报告将以格式保存Report_TIMESTAMP.html(例如:Report_16_5_2018_14_46_46.html) 我在这里做错了什么?

const createTestCafe = require('testcafe');
let testcafe = null;

createTestCafe()
.then(tc => {
    testcafe     = tc;
    const runner = testcafe.createRunner();

    let id;
    const deadlinePromise = new Promise((resolve,reject) => {
        id=setTimeout(() => {
       clearTimeout(id);
       reject('testcase couldnt meet the actual preferred time');
        },215000)
     });

const runPromise=runner
    .src(test1.ts)  
    .browsers('chrome:headless')
     // what am I doing wrong in the below step? the report is not saving properly
    .reporter('html-testrail', 'Reports/report1.html')        
    .run({skipJsErrors:true})             


race =Promise.race([runPromise,deadlinePromise])
race.then((res) => console.log(res))      

})

       .catch(failedCount => {
           console.log('Tests1 failed: ' + failedCount);
            testcafe.close();
        })

【问题讨论】:

    标签: testing automated-tests report testcafe testrail


    【解决方案1】:

    html-testrail 报告器忽略 output 选项并改用 HTML_REPORT_PATHHTML_REPORT_NAME 环境变量。您可以使用process.env 修改环境变量并将您的报告保存在所需位置:

    process.env.HTML_REPORT_PATH = path.resolve('Reports');
    process.env.HTML_REPORT_NAME = 'report1.html';
    

    【讨论】:

      【解决方案2】:

      要为“testcafe-reporter-html-testrail”报告器指定自定义输出文件,您需要指定相应的环境变量,如documentation 中所述。

      【讨论】:

      • 环境变量是在 index.js 中自动创建的,我需要知道是否必须更改 index.js 中的任何内容,以便在提供自定义名称时我的报告正确出现?我的印象是 .reporter('html-testrail', 'Reports/report1.html') 覆盖了 testcafe 中 index.js 中的默认设置,并创建了一个名为 report1.html 的报告,但这并没有发生。跨度>
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-12
      • 2013-04-25
      • 1970-01-01
      • 2015-01-12
      相关资源
      最近更新 更多