Java test coverage: who covers what?

限于喜欢 提交于 2019-12-22 05:37:13

问题


Is there a tool similar to emma, that reports which test covers a specific implementation ?


回答1:


In case you want to see, which tests cover which line of code, you may use Clover that shows you:

  • how many times one line got covered
  • which tests covered line in question

To see what one can expect from Clover, here is a screenshot:




回答2:


If you don't want to bother paying / setting up Cover, a much simpler way is:

  • remove / disable all breakpoints
  • put a breakpoint on the line that you which to know the tests covering it
  • re-run the tests in debug mode
  • look at the stacktrace to find the test calling it

This methods also allows you to see how many times a line is covered and all the tests calling it.



来源:https://stackoverflow.com/questions/12673912/java-test-coverage-who-covers-what

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!