1

I got this feedback during pull-request review:

seems to be very mixed unit and integration test

Imagine you have a django backend test. Both types of tests use the same tools (pytest, ORM, mocking, ...)

How to differentiate between both types of tests?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
guettli
  • 25,042
  • 81
  • 346
  • 663

2 Answers2

1

I would say that if it tests just one function then it is a unit test, if it tests a chain of more than one functions that interact with each other then it is an integration test.

This page explains it well.

0

I agree with Michael, unit tests are targeting the smallest possible case eg:

assert add(2, 4) == 6

An integration test contains more moving parts that may need to be stubbed/faked/mocked eg:

assert mult(10, add(2, 5)) == 70

You can say integration tests are checking how well units are integrating with each other. For tests including even more 'moving' parts of the application system tests are made.

Here's a video explaining it well: https://www.youtube.com/watch?v=vqAaMVoKz1c&feature=youtu.be