Post

Settle an argument: what is an integration test, and is that the same as an end-to-end test? Secondly, is testing a React component a "unit test"?

IMO: Unit tests test an indivisible piece of the software under test. An integration test is any test that isn’t a unit test. e2e tests are the subset of integration tests that deal with user input to user-observable output/effect. All relative to where the boundaries of your software are.

This is why they should just be called small, medium and large tests. A large test for React isn’t the same as a large test for your app. Who cares if it’s a “unit” or not.

The distinctions can be meaningful - for example any change that breaks an e2e test is by definition semver major.

0 reposts3 likes

That’s a shortcoming of the testing framework IMO - they’re not true e2e tests if they depend on details your user doesn’t act on/observe. If you had an AI testing framework that let you write “tap the most obvious button” -> “see confirmation page” you’d be a lot closer to e2e for human UIs.