Re:Observations on the testing culture of test-driven develo...
by canhascodez on Thursday August 16, 2018 @03:45PM
(#17777878)
It sounds like, "if you wish to make an apple pie from scratch, you must first invent the universe." But, hey, if it's good enough for the universe, who are we to try to improve on that?
The methods that process the data from the request, generate the database query, process the data returned from the database and generate the HTTP response can all be tested by setting up the function parameters and asserting on the return value. Setting up mocks to do things like assert that the function calls another method with a particular set of parameters is not necessary.
As for testing interactions with the HTTP client and database, one can set up an environment that runs a actual HTTP client and an actual database server (populating it with test data). Testing against actual implementations is always better than testing against mocks.