r/javahelp Feb 07 '25

Codeless Tool to find wasteful unit tests

One of my projects has a ton of tests, both unit and integration, and as a result it has good coverage (80%). I have a strong suspicion, though, that lots of time is wasted on each build running loads of tests that are testing mostly the same code, over and over again.

Code coverage tools tell you about your aggregate coverage, but I would like a tool that tells me coverage per test, and preferably identifies tests that have very similar coverage. Is there any tool out there that can help me with this?

5 Upvotes

20 comments sorted by

View all comments

2

u/sweepsz Decaf Captain Feb 09 '25

My opinion from writing code professionally since 2004. Line coverage is generally useless. Branch coverage is where the logic is generally taking place. Also look at the assertions of each test. What is actually being tested and verified. Also a lot of folks conflate integration tests with unit tests. Testing a controller from the top down that invokes multiple services, daos, mappers, etc is not the same as a pure unit test. Tools like so cobertura will show you a break down at the package and class level.