问题
I am studying TDD and developing an API in Django Rest Framework, and I had a need that I researched and could not find some tools to solve my problem, I am trying to find out how much my tests cover my application in %.
For know the number of possibilities and possible suggestions of what is missing cover, I found the coverage
lib, but it generates a report with lots of data, which are not very useful for my case, I just want to know the coverage of my tests that I created. Does anyone know of any tool or plugin for pycharm that does this coverage of the tests?
I know that in visual studio there is Ncrunch that does this, but I do not know if there is something similar in pycharm.
回答1:
I was struggling with the same question.
Especially I wanted to visualize the execution path of each test and run only affected tests.
I created a tool that sits in the background and runs only impacted tests:
(You will need PyCharm plugin and pycrunch-engine
from pip)
https://pycrunch.com
https://github.com/gleb-sevruk/pycrunch-engine
This is how it looks like:
It is currently in beta, and may not support all usage scenarios, but I use it every day for development, without major issues.
回答2:
I found a tool in the professional pycharm of which does what I need, is the functionality of running the tests with coverage, there is an option that runs the tests again to check if everything is ok:
And in this tool there is also another feature that shows the coverage of your tests against the existing code:
I hope I can help someone who has the same doubt! Thanks!
来源:https://stackoverflow.com/questions/53671783/tools-to-coverage-tests-django-rest-framework