Re:Is TDD Dead? (2014)
by 411111111111111 on Wednesday August 26, 2020 @09:47AM
(#24282391)
Mocks are worthwhile though. Otherwise you end up not being able to unittest anything which accesses an external api such as databases, rest services etc.
[ Parent
| on HN ]
IMO, databases is often an integral part of the program and should be part of the test (a real database in a docker image).
For instance, if you are not relying on unique constraint in the DB to implement idempotency you are probably doing something wrong, and if you are not testing idempotent behaviour you are probably doing something wrong.
Re:Is TDD Dead? (2014)
by matkoniecz on Wednesday August 26, 2020 @12:07PM
(#24283793)
I have plenty of tests actually calling database. Maybe it is not a proper unit test, but it is not a problem for me.
I want test to protect me against regressions, and I do not really care how they are classified.
Re:Is TDD Dead? (2014)
by mumblemumble on Wednesday August 26, 2020 @09:58AM
(#24282509)
It really depends on your definition of unit. In the London school of TDD, no, a unit cannot extend across an I/O boundary. The classicist school takes a more flexible, pragmatic approach.
I'd love to know the story behind "the London school".
Re:Is TDD Dead? (2014)
by insertnickname on Wednesday August 26, 2020 @12:42PM
(#24284204)
It's all in this book: http://www.growing-object-oriented-software.com/
Intriguing. Thanks!
You mean fakes/stubs, right? Unless you're testing whether you're correctly implementing the protocol exchange with an external party, you don't need to record the API calls.
Re:Is TDD Dead? (2014)
by mannykannot on Wednesday August 26, 2020 @01:39PM
(#24284956)
How do you test your mocks?
Re:Is TDD Dead? (2014)
by jacobsenscott on Wednesday August 26, 2020 @07:50PM
(#24288637)
How do you test the tests that are testing your mocks? That said verifying mocks are a great help - they won't let you mock methods that don't exist on the real object.
Some mocking libraries, like the VCR library in ruby, can be turned off every now and then so you tests hit real endpoints. It is worth doing from time to time.