views:

141

answers:

4

I recently inherited a nice size projects with about 100k lines of code and would like to find out what code is actually being run. I've found a number of routines that are not called at all and looking for a fast and automated way to explore the Business Layer to see what other code can be refactored out quickly.

This is an ASP.NET website with VB.NET codebehind and Business Layer.

+4  A: 

I personally like the ReSharper and its "Find all usages" functionality. There is a couple of advanced options but essentially it can quite quickly find all the places where a particular unit is used (function, class, interface).

I believe you are confusing the term Code Coverage a little bit, usually what is meant by it is the percentage of code that is covered by test cases (automated unit tests) and this can be easily determined with many tools, e.g. NCover or MS Test coverage in some versions of Visual Studio.

Thomas Wanner
Not to mention, resharper greys out "dead code" automatically.
womp
+3  A: 

You can use NDepend - it is a static analysis tool with an integrated query language that will allow you to search for and find classes and methods that are not used in the codebase. See this article for some details of how to achieve this.

There are also several other similar SO questions on this subject with good answers.

Oded
+1  A: 

TestDriven integrates well with Visual Studio and has the option to start the project in "code coverage" mode.

This will give you some nice statistics about which lines of code are being executed (I used it to analyze how much of the code my unit tests cover).

Ando
+1  A: 

There's also nCover -- has both path, and basis coverage.

ascarb