Question

I am attempting to target a rather large class that uses lots of smaller components. At the moment I have no idea how much of the smaller components are unit tested.

Is there a tool or method to show all of the untested dependencies [plus sub-dependencies] that are used within the larger class?

I realize that I can do a full project wide code coverage, and that I can generate a list of all of the tested components. However, what can I do to see that in the perspective of that individual class?

Why am I asking this? It would not be effective for this test case to be written without the sub-components to have their methods tested.

I am currently using:

  1. JUnit 4.11
  2. Java
  3. JaCCO [emma compatible]
Was it helpful?

Solution

@monsky, This is an interesting question.

Jacoco gives you the flexibility to include or exclude a specific set of classes in your coverage. IF you want to find code coverage of only dependent classes, you can do 2 things.

  1. Find out recursively all the dependent sub-modules of the class that need to be covered. Using this, when you invoke Jacoco, mention an explicit list of classes that you want to include coverage for. You can do this using the includes element of Jacoco .

    http://www.eclemma.org/jacoco/trunk/doc/ant.html

  2. In case you have a ready list of files that you want to cover, just mention it in the includes syntax, you do not have to generate a dynamic list of dependencies. I would however go with 1.

You can use intellij IDe to do it as well http://jetbrains.com/idea/webhelp/analyzing-dependencies.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top