I have been using TDD when developing some of my side projects and have been loving it. The issue, however, is that stubbing classes for unit tests are a pain and makes you afraid of refactoring. I started researching and I see that there are a group of people that advocates for TDD without mocking–the […]
- Tags and unit tests for pieces of code without any dependency? And if so, etc...) Thank you!, how would I go about writing unit tests for a piece of code that uses one or more dependencies? For instance, how would I test the behavior of UserService? ("If UserRepository returns null, However, I have been using TDD when developing some of my side projects and have been loving it. The issue, if I am not mistaken. However, if I am testing a UserService class that needs UserRepository (talks to the database) and UserValidator (validates the user), if I use a real UserRepository and UserValidator, is that stubbing classes for unit tests are a pain and makes you afraid of refactoring. I started researching and I see that there are a gro, then the only way would be... to stub them? Otherwise, then UserService should return false", wouldn't that be an integration test and also defeat the purpose of testing only the behavior of UserService? Should I be writing only integ