julien88
julien88

Reputation: 71

How to generate Junit output report using Behave Python

I'm using Behave on Python to test a web application. My test suite run properly, but I'm not able to generate junit report.

Here is my behave.ini file :

    [behave]
junit=true
format=pretty

I only run behave using this command :behave

After run, the test result is print in the console, but no report is 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 ?

Upvotes: 7

Views: 10010

Answers (3)

botchniaque
botchniaque

Reputation: 5084

Make sure you don't change the working directory in your steps definition (or, at the end of the test change it back to what it was before). I was observing the same problem, and it turned out that the reports directory was created in the directory I changed into while executing one of the steps.

What may help, if you don't want to care about the working directory, is setting the --junit-directory option. This should help behave to figure out where to store the report, regardless of the working directory at the end of the test (I have not tested that though)

Upvotes: 2

phaneendra
phaneendra

Reputation: 41

Try using

behave --junit

on the command line instead of just behave.

Also, you can show the options available by using:

behave --help

Upvotes: 2

E A Harris
E A Harris

Reputation: 17

I have done a bit of searching and it appears that the easiest way to do this is via the Jenkins junit plugin.

It seems to me like there ought to be a simple way to convert junit xml reports to a human readable html format, but I have not found it in any of my searches. The best I can come up with are a few junit bash scripts, but they don't appear to have any publishing capability. They only generate the xml reports.

Upvotes: -2

Related Questions