Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
Unit tests, integration tests and even acceptance tests or end to end tests overlap a lot. I consider the main differences to be:
The amount of code under test.
How much the test reflects the end user's experience.
In terms of size, they overlap. End to end tests can be very small (e.g. testing that a page displays the correct title) or very large (e.g. testing that a main feature works). A unit test can test a single small function, or it can test a function which calls many other functions (like a mini-integration test). However, often, unit tests are small, integration tests are larger and end to end tests are even larger.
The second consideration is how closely the test matches the end user's experience. An end to end test or acceptance test matches the user's experience very closely. For example, when doing end to end testing with Cypress, you essentially simulate the end user using your website. An integration test which tests a feature in code (without rendering it and without network requests) is "further away" from the user's experience, but it may still test an entire feature which an end user would understand. A small unit test is something much further from the end user, they wouldn't be interested about those low level details..
TLDR: They overlap a lot. I don't think we have anything which clearly categorizes them in all cases. Consider the amount of code under test and how closely the test reflects the user's experience.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
Unit tests, integration tests and even acceptance tests or end to end tests overlap a lot. I consider the main differences to be:
In terms of size, they overlap. End to end tests can be very small (e.g. testing that a page displays the correct title) or very large (e.g. testing that a main feature works). A unit test can test a single small function, or it can test a function which calls many other functions (like a mini-integration test). However, often, unit tests are small, integration tests are larger and end to end tests are even larger.
The second consideration is how closely the test matches the end user's experience. An end to end test or acceptance test matches the user's experience very closely. For example, when doing end to end testing with Cypress, you essentially simulate the end user using your website. An integration test which tests a feature in code (without rendering it and without network requests) is "further away" from the user's experience, but it may still test an entire feature which an end user would understand. A small unit test is something much further from the end user, they wouldn't be interested about those low level details..
TLDR: They overlap a lot. I don't think we have anything which clearly categorizes them in all cases. Consider the amount of code under test and how closely the test reflects the user's experience.