Why would you use stub
given that you should be testing real classes anyways?
I know there are cases that you don't want to test other classes and not go through its other associated class methods but I still think it's better to use real methods.
I can only really see a benefit when you want to quickly skip one method's other associated tasks and return the end result to be used in tests
Are there other benefits though that we should be considering?
(In addition to above I also think stub
is risky aswell since your code can change as it evolves and may generate different output to what it is generating in the tests)
stub
and rather actually test out with database interaction aswell? (with test database and test data) – Passionate Engineer