How to create a Junit output report using Behave Python

I am using Behave in Python to test a web application. My test suite is working correctly, but I cannot create a unit report.

Here is my behave.ini file:

[behave] junit=true format=pretty 

I start only with this command: behave

After starting, the test result is printed on the console, but the report is not generated.

 1 feature passed, 3 failed, 0 skipped 60 scenarios passed, 5 failed, 0 skipped 395 steps passed, 5 failed, 5 skipped, 0 undefined Took 10m17.149s 

What can I do?

+5
source share
3 answers

Make sure that you do not change the working directory in your steps definition (or, at the end of the test, change it to what it was before). I observed the same problem, and it turned out that the reports directory was created in the directory in which I was changed by doing one of the steps.

Which may help if you do not want to care about the working directory by setting the --junit-directory option. This should help to behave to figure out where to store the report, regardless of the working directory at the end of the test (I have not tested this yet)

+1
source

I did a little work and it seems that the easiest way to do this is through the Jenkins junit plugin.

It seems to me that there should be an easy way to convert junit xml reports to a human-readable html format, but I did not find it in any of my searches. The best I can come up with are some junit bash scripts, but they don't have the ability to publish. They only generate xml reports.

-2
source

Try using

 behave --junit 

on the command line instead of behave .

In addition, you can show the available options using:

 behave --help 
-2
source

Source: https://habr.com/ru/post/1237637/


All Articles