• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dependency Injection & Testability

 
shanthi naidu
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Dependency injection is simply a good idea and it helps with: testability


Please can anyone tell me how dependency injection helps with testability

Thanks,
Shanthi Naidu
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, let's start this way--what's your understanding of what dependency injection is? Can you think of any reasons it might make testing easier?
 
shanthi naidu
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well with dependency injection we can inject the mock objects first till we get the required output and then inject the original objects ... in this way testing became flexible with dependency injection??
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's probably the biggest testing advantage, yes--it allows us to choose what exactly to test.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic