Another title might be: determine strongest candidates for 100% test coverage. I'm looking for a tool that will display the methods/functions that are most depended on by my code base. To be clear, I'm looking for internal dependencies, not external. The idea is to ensure that the most depended-on code written has full test coverage, or at least high priority for testing.

I believe this is related to cyclomatic complexity. I presume a tool that is checking code paths should be able to compute which code shows up in the most paths. But I haven't seen a tool that does this. Java/JVM preferred, but curious for any language.

  • What do you expect from those tools? Can you provide such the tool's report example? What valuable and measurable metrics do you expect? – Alexey R. Mar 20 '18 at 9:39
  • Am I correct in thinking you are looking for a tool that will report that for example function abc() is called in 50 classes where function xyz() is called in 10 classes? – Kate Paulk Mar 20 '18 at 11:50
  • @KatePaulk is has the gist of it, although having the number of 2nd, 3rd, etc. level calls is important, too. Maybe it's only called by one function, but the caller is heavily depended upon. – Philip Mar 20 '18 at 18:01

Why do you think that goal of coverage is 100%? Due to law of Diminishing returns, increasing coverage in other modules is more beneficial that 100% coverage in few.

Also, cyclomatic complexity cannot guesstimate which code is used most by your users.

You need to collect the usage info, and aim for higher coverage for most often used modules (determined not by guess, but by profiling). Example: 90% coverage (excluding exception handling) for top 10% of modules by usage, 80% for next 20%, and 60-70% for the rest. And of course track and note if code change decreased the coverage.

There cannot be a tool, because too many guesses are involved. So do your best guesses, using expert opinion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.