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.

Eg: testing a React component may be a unit test if you’re writing an app, but an e2e test of the react library itself.

0 reposts3 likes

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.

For me, unit tests are the ones best written as you specify the component in question and you have it from the get-go, they are tightly bound to their components. Some testing protocols for a whole product or set of components can be written early, but they aren't so tightly bound.

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.