cobertura in eclipse
Asked Answered
R

3

11

I just installed ecobertura plugin, but it looks like not a very user-friendly tool from within eclipse. is there any good plugin for cobertura in eclipse or article to describe how to use ecobertura?

I'm used to seeing code complexity and coverge etc in a very nice way.

I need to use cobertura, because the build system in the back-end uses it, so it makes sens to use it in the IDE as well.

Regards

Regin answered 17/2, 2011 at 11:36 Comment(5)
What are you missing. I think there is not much more to document than on the documentation page.Descriptive
I think you are right, there is not much this plug-in doesRegin
Please don't misunderstand me. The plugin does what it should. It generates a code coverage, presents the results in a special view and colors your code. Pretty similar to an original cobertura report.Descriptive
well, yeah, but you can't tell it what to include and exclude (or I can't figure out how to do that)Regin
I would like to set what classes to try to check and what classes are not needed to be checked. Also no complexity metrics information is shown (probably it doesn't support that)...Regin
H
18

I was looking for a tutorial for our team members to start using eCobertura and came across here. I end up writing one myself. Posting back here hope it may help others looking for a jump start.

http://kennethxu.blogspot.com/2012/01/cobertura-and-eclipse-ecobertura.html

Helvetian answered 15/2, 2012 at 0:53 Comment(2)
Note: Kenneth has updated his blog post saying he's move to using EclEmma plugin.Admit
I'm using both, I still need eCobertura because EclEmma seems to have issue with reflection code and powermock.Helvetian
F
5

From the sources:

  • there should be launch configuration's "filters" tab, for you to define what class to filter and analyze: see changeset 2ecbb202e8c5
  • there is no instances of "cyclomatic complexity" anywhere in the code.

But you still can fork the code base (like mileszk did) and add any feature you want (and contribute back to the main project of course ;) )

Forcier answered 18/2, 2011 at 7:38 Comment(0)
N
2

I am using Eclipse Luna and I had difficulty installing the ecobertura plugin. So I installed EclEmma plugin and it was intitutive to use it. After installing the plugin, restart the eclipse IDE.

To find the coverage of the test cases you have written, all you have to do is

Right click on the desired package or even the whole project > Coverage As > Junit Test

The Coverage View automatically appears. Or you can open the coverage view from Window > Show View > Other > Java > Coverage. Or you can just type "Coverage" in the Quick Access search box in the eclipse.

The Coverage view is capable of displaying the coverage percentage at project level, source folder level, package level, Class level and even at method level.

Coverage View

You can change the root level of the entries shown in the coverage tree by using the toolbar in the coverage view.

Tool bar in the Coverage View

enter image description here

You can change the coverage parameters to method or Line or instruction or brach based on your requirement.

enter image description here

And finally you can export the test coverage results to HTML or XML or CSV formats by right-clicking anywhere inside the coverage view and selecting Export session.

enter image description here export test coverage report export test coverage report format

Newt answered 1/2, 2016 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.