I don’t do TDD religiously, but I’m trying to move in that direction. Writing the test before code makes you write your code in a more testable way.
Typically I will mock and do integration. I like mocking when I’m testing a small piece of functionality and I want to mock away another dependency so I don’t have to worry about it. But then I’ll have an integration to make sure it all works together.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very nice.
Do you write your unit tests before (TDD) or after the code is written?
Also, do you prefer mocking dependencies or integration tests?
I don’t do TDD religiously, but I’m trying to move in that direction. Writing the test before code makes you write your code in a more testable way.
Typically I will mock and do integration. I like mocking when I’m testing a small piece of functionality and I want to mock away another dependency so I don’t have to worry about it. But then I’ll have an integration to make sure it all works together.