fenreer fenreer - 4 months ago 48x
Python Question

How can I get code coverage data from Python BDD functional tests using Behave?

I haven't seen an answer for this specific question (Test coverage tool for Behave test framework) and I haven't seen any Google search results produce a sufficient answer. Therefore...

How can I get a code coverage report from Behave? I find it hard to believe that there are no Python developers using BDD methodology and I find it even harder to believe that those Python developers who are using BDD are doing so without code coverage statistics from their functional tests. Can Coverage.py be used to drive Behave to produce code coverage? How?


I don't know how to use behave, but I used Cucumber for BDD, which I think probably almost similar. And so I think you should be able to use behave with coverage. you have to specify which file to include in the file.. (I used it with cucumber). See if this might help.

Hope this answer your question :)

# .coveragerc to control coverage.py
parallel = True

# if you want to include tests append tests/*
include =

source =

tests =