getting 404 error when generating allure report in protractor using allure command line tool

半世苍凉 提交于 2019-12-02 10:08:11

问题


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

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

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 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.

and also tried to start jetty server using command :-

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

but in both cases, I got error:-

The goal you specified requires a project to execute but there is no POM in this directory

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?

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);
    });
   },

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

report screenshot

Project folder structure


回答1:


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

allure will spin up a web server.

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

add this to your script in package.json.

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

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



来源:https://stackoverflow.com/questions/53138595/getting-404-error-when-generating-allure-report-in-protractor-using-allure-comma

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