How to know if you are writing integration tests or end to end tests
July 22, 2020 • ☕️ 1 min read
-
Unit tests: Unit tests are atomic. They are within the scope of one component or action or reducer or saga and do not go beyond the scope of this atomic component.
- Example: Unit tests do not involve
reducer && saga
being tested together orcomponent && action && reducer && saga
being tested together.
- Example: Unit tests do not involve
-
Integration tests: Integration tests are an extension of unit tests and involve integrating multiple components.
- Example: component click on button -> throws an action -> watched by the saga -> calls an api endpoint (mocked) -> modify reducers state -> changes something on the same or another component.
- End to end tests: We use Cypress for end to end testing where we test the end results like how an external user with interact with our system / UI.
Resources
-
🤔 Question for tech folks 🤔
— Carolyn Stransky (@carolstran) November 13, 2019
"How do you differentiate between integration tests and end-to-end tests? They're very similar and I cannot for the life of me define a concrete line where one ends and the other begins."
Anyone have thoughts or resources on this? - https://kentcdodds.com/blog/unit-vs-integration-vs-e2e-tests