Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get unit test coverage results in Eclipse + Pydev?

I know Eclipse + PyDev has an option Run As => 3 Python Coverage. But all it reports is:

Ran 6 tests in 0.001s

OK

And it says nothing about code coverage. How to get a code coverage report in Pydev?

like image 994
Jader Dias Avatar asked Feb 14 '10 21:02

Jader Dias


People also ask

What does coverage mean in JUnit?

Eclipse can check your code coverage when it runs your JUnit testing class. This means that it can show you what statements were executed in at least one test case and what ones weren't. For an if-statement, it will tell you whether there was a test case for the condition to be false and another for it to be true.

What is coverage Pytest?

Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not. Coverage measurement is typically used to gauge the effectiveness of tests.


1 Answers

  • Run a file with "Python Coverage"
  • Window > Show View > Code Coverage Results View
  • Select the directory in which the executed file is
  • Double-click on the executed file in the file list
  • Statistics are now at the right, not executed lines are marked red in the code view

Actually this is a really nice feature, didn't know about it before :)

like image 57
AndiDog Avatar answered Sep 22 '22 22:09

AndiDog