Using allure-behave in python to generate reports

93 Views Asked by At

I'm using Allure-Behave to try and generate reports in my automated test suite. I can't find any documentation online for it. Everything I can find is either through using the terminal, which I don't want to do, or isn't for behave.

Currently my afterall() function looks like the below

@async_run_until_complete
async def after_all(context):
    await allure_report("tests/features/reports")

However, when running a test, I get an error

HOOK-ERROR in after_all: TypeError: object NoneType can't be used in 'await' expression

Is anyone able to assist and help me get this working?

1

There are 1 best solutions below

0
sashkins On

Have you tried allure-behave?

It can be easily plugged in via behave formatters.

After the installation of the lib you can just add the following lines to your setup.cfg / behave.ini file:

default_format = allure_behave.formatter:AllureFormatter
outfiles = .\allure-report\

If you are not using the config file, you can run the same from the cmd:

behave -f allure_behave.formatter:AllureFormatter -o .\allure-report\ .\features