Python – Allure reports show 404 errors in the report, although the history captures the correct data

Allure reports show 404 errors in the report, although the history captures the correct data… here is a solution to the problem.

Allure reports show 404 errors in the report, although the history captures the correct data

I started the test and generated XML:: like this

pytest LoginTest.py --alluredir C:\Users\jfriend\Desktop\Allure\xml

So I have a directory in the path above that contains XMLs/txt files. This is good.

I now want to generate reports at the same time as they are provided. Looking at the docs looks like I have to do something similar :

allure generate C:/Users/jfriend/Desktop/Allure/xml

This should generate a report in the directory I’m currently in the CLI. It should use the adapter in the above path to get the results generated from pytest.

Instead, it generates a report, but only displays a 404 error in the middle of the page. It’s weird.

If I read the history, it has the correct data – so it reads the XML directory clearly. If I run the service command like this:

allure serve C:\Users\jfriend\Desktop\Allure\xml

It displays the test correctly. So it can clearly see the results and can display them, but it just refuses to generate it for some reason.

Any ideas? I just want to keep static reports with server reports, purely for archival reasons.

Solution

Allure Report is a SPA that uses AJAX to get page content. Chrome blocks access to files on the file system (such checks can be disabled with the —allow-file-access-from-files option).

Therefore, you need to use a web server to provide reports for viewing. The Allure command line has the open command that starts Jetty for you.

P.S

The allure

serve command is a shortcut to allure generate & allure open.

Related Problems and Solutions