1
votes

I am working on a MVC project and trying to use TDD with DDD and finding it's not that straight forward. Below are some of the topics i am struggling on:-

  1. How to do proceed with unit test once you have written tests for Controller class. i.e service, repository, domain etc
  2. At what point you write and develop your domain with services and repository.
  3. Do you create services/model(domain) for simple task where there is not much model/logic to fetch data and display. If not how do you design it.

Getting some experienced hand input would be lovely and example(s) would be really helpful. I am using outside in approach as i know it will be MVC project and I will be using SQL. Thanks in advance

1
TDD and DDD, live together in perfect MVC, side by side in your project's codebase, oh lord, why don't we?Cpt. Senkfuss

1 Answers

5
votes

If you do DDD, then start with your domain (Entities, Domain services). Use TDD to help you design your entities and domain services. You should focus 80% of your energy here.

Controllers, Views are really just plumbing sitting on top of your Application services. TDD won't yield much benefit in this area. Instead consider writing End to End test using Selenium for example to make sure things are correctly configured and holding together, but do not test business logic using End to End tests.