Skip to content

Unit Testing and what to do with the database? #31

Answered by valentinacupac
Daissy538 asked this question in Q&A
Discussion options

You must be logged in to vote

Great question @Daissy538! Databases are definitely a controversial topic.

BACKGROUND

Currently, there are three approaches:

  1. Mockist school - they mock all collaborators (i.e. mocking out any collaborators for some class)
  2. Classicist school - they mock out only shared dependencies (like access to DB, file system, etc.)
  3. Vladimir Khorikov - he wrote "Both schools are wrong in their treatment of mocks" and describes to NOT mock out the DB https://enterprisecraftsmanship.com/posts/when-to-mock/ --> so with this his approach is different compared to the 2 schools above

Currently, there is no general consensus regarding this, what is better?

Why I'm illustrating the usage of test doubles in th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Daissy538
Comment options

Answer selected by Daissy538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants