taverntesting/tavern

How to measure coverage for tavern tests?

Closed this issue · 1 comments

First of all, thank you for creating such nice API testing framework on top of pytest

Would like to be able to measure coverage for Fastapi application, I am trying to use tavern-fastapi plugin if using TestClient would solve the issue for measuring coverage, however getting error zaghaghi/tavern-fastapi#2

Is there anyway to get tavern tests executed in a way that pytest-cov would give right measures for Fastapi tests written in tavern? Maybe even something that would not require using specific client 🤔

because Tavern isn't running in the same process as your Python server, If you want to do that you'll need to run your server under 'coverage' like:

$ coverage run path/to/server.py

Run tavern tests against that running server, then do 'coverage report' (or however you are using that data) to get the coverage output