0%

Data Access/Layer Tests

Description

These tests are all about “are we using our data source correctly?” Frequently these tests will interact with a database (eg, MySQL) and will test out, from our domain perspective - as in using domain classes, how we retrieve, change, delete, and add data to the source.

Quick Sheet

Pros:

  • Can focus on data interactions and gotchas which might be within the tech stack specific to data

Cons:

  • Slower running (database interactions)

DO:

  • Test your data interaction logic
  • Test logic around massaging data into domain concepts

DONTs:

  • Test full stack (unless your whole stack is just data manipulation…)

Example Psuedo Code Test

There exists a method:
add_product_to_database(product)

Example Test:

Product_is_added:
clean_database
add_product_to_database(product)
assert product in database.get_products()

Tools of Note

Usually utilizing same as Post not found: unit-tests