Where to start with building testable applications?

Posted 3 years ago by davestewart

I've generally been OK with the code I've written over the years - that is, I'm experienced enough not to write terrible spaghetti code, but it's pretty clear now I'm looking more at making parts of my app testable, that my "good habits" aren't enough.

  • I'm good at chunking up my classes to have methods that do only one thing
  • my classes generally do only one thing
  • I'm using DI much more then before
  • My constructors now don't do very much

However, when things get complicated, I can still find it a real challenge to work out how to make classes that have a bunch of dependencies, or require a few other classes to be running and set up with config, etc, to operate more cleanly.

A lot of the tutes out there regarding testing apps give you the "this is how you test a class" info, but I've been struggling to find information regarding "thinking" in the way to build apps in a testable way from the outset.

Can anyone point me towards any good resources?

Thanks.

Please sign in or create an account to participate in this conversation.