DEV Community

Discussion on: How to implement test driven development in the real world?

Collapse
 
slavius profile image
Slavius • Edited

I found it really hard to write tests against Interfaces, Classes, Properties and Methods that do not yet exist. They basically make my solutions to not compile and throw a bunch of errors. If you ever find a way, please let me know...

I mean if you write a complex test against non-existent code then you've actually already:

  • architectured new application feature according to a user story
  • decided where the business logic will be
  • made a naming convention decisions
  • made accessibility decisions (private, public, protected)
  • made OOP decisions (Interface, Class or static class with static method)
  • made OOP decisions part.2 (constructor, destructor, implements IDisposable)
  • made OOP decisions part.3 (constructor parameters with Dependency Injection)
  • made input output types and model decisions

If you've made all this (which IMHO takes most of the time), why didn't you just also write the method body?

Collapse
 
tomtomdurrant profile image
tomtomdurrant

I suppose it’s a question of ‘Are you doing TDD in a pure fashion?’ Vs ‘Do you want to be pragmatic about how you implement a good practice?’