Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine which code in a project/solution is the most often used?

If I have an existing solution containing multiple c# projects, are there any static analysis tools that can help me determine which areas of code are the most often used?

I'd like to use this information in order to determine which areas should have their test coverage ramped up first.

I've looked at some static analysis tools already, but they mostly seem to focus on things like complexity, coding conventions, code duplication etc.

Alternatively, if there aren't any analysis tools available that can do this, do you have any advice about how to determine which code I ought to focus on testing first?

Thanks!

EDIT: Just to clarify, what I'm looking for isn't code coverage. I'd like a rundown of which parts of my application are most often used, so that I can in turn focus on improving the coverage in those areas. I'm trying to avoid just writing tests for areas that don't yet have any, as they may be edge cases that aren't often executed.

like image 279
BenA Avatar asked Oct 16 '09 15:10

BenA


1 Answers

Even static analysis tools which do try to figure out what happens at run-time do not usually try to estimate how often a piece of code is executed. The subject is hard enough as it is!

But dynamic analysis tools (e.g. profiling tools that either rely on transparent instrumentation of the code or use sampling) can tell you, after one or several "typical" executions (you provide the entries that you judge typical), how often this or that function was executed.

See Profiling (computer programming) on Wikipedia.

like image 83
Pascal Cuoq Avatar answered Sep 18 '22 10:09

Pascal Cuoq