如何在守夜人中设置诱惑报告?

How to setup allure-report in nightwatch?

我对诱惑报告还很陌生。有人可以分享 nightwatch 中 allure-report 的设置和配置部分吗?

全局模块

const path = require('path');
const cwd = process.cwd();

module.exports = {
    reporter: function(results , done) {
      let srcResult = path.join(cwd,'/reports/client','*.xml');
      console.log('path to the reports'+srcResult);
      var generation = allure(["generate", "--clean", srcResult]);
      generation.on ('exit',()=>{
        done();
      });
    }
};

path to the reportsC:\uiautomation\reports\client\*.xml
C:\uiautomation\reports\client\CHROME_80.0.3987.122_Windows_user_registration.xml is not a directory
Report successfully generated to allure-report```


你可以尝试使用allure-commandline

试试这个:

  • 运行 npm install allure-commandline --save-dev
  • 使用以下代码创建外部 global.js:

var allure = require("allure-commandline");

module.exports = {
    reporter: function(results , done) {
      let srcResult = "../path/to/your/xml/result";
      var generation = allure(["generate", "--clean", srcResult]);
      generation.on ('exit',()=>{
        done();
      });
    }
};

在此之后,您应该能够找到 allure result 文件夹,您可以使用 allure open 命令打开它们。另外请记得在你的 nightwatch conf 文件中配置你的 globals_path