Update: Here's how you can extend Depender with your own dependency rules
Depender is a tool that I created to illustrate several concepts both for my book and both for my training classes. I think it should prove valuable (as it gets more and more features) to anyone who is trying to write tests for existing code.
Depender allows you to load an assembly and inspect the types within it according to very simple rules. the main question on my mind and I run it is: "How easy would it be to test class X?". Depender will list all the classes in the assembly and for each one will try to detect possible testability problems (non decoupling) and places where you might be able to "inject" your own implementation (calls to virtual methods, fields that are interfaces or types who are not sealed..etc..)
so you can:
- see places where you might want to refactor your code or use a tool like Typemock Isolator
- see places where you can already use "seams" to inject behavior into your code without needing to look up the source code manually.
here's what the main screen looks like when loading an assembly:
the type "RealLogger" is marked in red because it contains calls to static methods. double clicking on the type's node will load a separate window just for this type:
I will be adding more rules and also releasing the source so that other people can help develop this. for now I just want to get it out there and see what people think.
- Make it command line driven so it can run in your CI builds
- Make it give "scores" to assemblies or types on testability and decoupling
- Make it add "suggestions" on how to fix decoupling issues
- Make it create the base diagram for my test feasibility matrix
Download Depender from here.