本文介绍了使用诱惑命令行工具在量角器中生成诱惑报告时出现404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图首次在量角器中生成诱人的报告,

I am trying to generate allure report in protractor for the first time,

要生成诱惑报告,我正在使用茉莉花诱惑报告程序:1.0.2和诱惑命令行工具:2.7.0版本

To generate allure report I am using jasmine allure reporter:1.0.2 and allure-commandline tool:2.7.0 versions

在我的conf文件中,我已经添加了用于在特定文件夹中生成xml结果的代码,然后我使用了allure-commandline工具来生成html报告,该报告将在项目主目录中名为"Allure-report"的文件夹中生成,但是现在当我打开通过使用allure-commandline工具生成的index.html文件时,我在报告的不同部分中看到404错误

In my conf file I have added the code for generating xml results in a specific folder and then I am using allure-commandline tool to generate html report which gets generated in a folder named "Allure-report" in the project home directory, but now when I open the index.html file generated by using allure-commandline tool then I see 404 error in the different sections of report

此外,我还尝试运行以下命令:-

Further I also tried to run following commands :-

MVN网站-Dallure.results_pattern = F:\ Backup \ Protractor-Workspace \ Typescript_framework \ Test_results \ Allure-result ,此命令从运行运行规范文件时生成的xml文件生成html报告.

mvn site -Dallure.results_pattern= F:\Backup\Protractor-Workspace\Typescript_framework\Test_results\Allure-result ,this command to generate html report from xml files which get generated upon running spec files.

,还尝试使用命令:-

mvn jetty:run -Djetty.port = 1332 此命令启动码头服务器

mvn jetty:run -Djetty.port=1332 this command starts jetty server

但是在两种情况下,我都出错了:-

but in both cases, I got error:-

您指定的目标需要执行一个项目,但是此目录中没有POM

进一步,为了进一步解释,我还尝试从node_modules/jasmine-allure-reporter文件夹中启动码头服务器,但是发现其中没有pom.xml文件,由于该原因我再次得到该目录中没有POM" 错误

Further, To explain further, I also tried to start jetty server from inside node_modules/jasmine-allure-reporter folder but found that there is no pom.xml file in it due to which I again got "no POM in this directory" error

请让我知道我现在应该做什么?

Please let me know what I should do now?

下面是我在conf.ts文件中编写的用于生成魅力报告的代码:-

Below is the code I wrote in conf.ts file for generation of allure report :-

var AllureReporter = require('./node_modules/jasmine-allure-reporter');
    jasmine.getEnv().addReporter(new AllureReporter({
      resultsDir: './Test_results/Allure-result'
        })
      );
  var allure = require('allure-commandline');
  var generation = allure(['generate', './Test_results/Allure-result']);
   generation.on('exit', function(exitCode:any) {
      console.log('Generation is finished with code:', exitCode);
    });
   },

下面是我的项目文件夹结构的屏幕截图以及404错误未找到的html报告

Below are the screenshot of my project folder structure and the html report with 404 not found error

报告屏幕截图

项目文件夹结构

推荐答案

您不应像普通html一样打开index.html文件.

You should not open index.html file like a normal html.

魅力将启动Web服务器.

allure will spin up a web server.

"scripts": {
"allure": "node_modules/.bin/allure generate ./allure-results -c && allure open"
},

将此添加到package.json中的脚本中.

add this to your script in package.json.

创建allure-results文件夹后(即测试完成),运行npm run allure

After your allure-results folder is created (i.e) test completes run npm run allure

运行npm run allure之后.您的默认浏览器将自动打开报告.

After you run npm run allure. Your default browser will automatically open the report.

这篇关于使用诱惑命令行工具在量角器中生成诱惑报告时出现404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 11:10