FarFarAway
FarFarAway

Reputation: 1115

When to do E2E Testing

I am working in a project (angular and spring boot) and we do UnitTests and Integration tests. I am a little confused about E2E testing. When should I use E2E testing, what advantages could e2e Test bring to me.

When UnitTest suffices, when I sould use E2E Test.

This is a general question and it does not releate to a specific technology

Upvotes: 1

Views: 1296

Answers (3)

Omolade Ekpeni
Omolade Ekpeni

Reputation: 84

E2E (End-to-End) testing validates entire user workflows, ensuring all parts of your application (frontend, backend, database) work together as expected. It is ideal and important for testing critical user journeys like login, checkout, or form submissions, especially when features span across multiple systems or parts of the application.

Unit tests, on the other hand, focus on individual functions or components in isolation and are faster and cheaper to run. They are sufficient for validating specific logic or component behavior without external dependencies.

E2E testing can be used to validate real-world scenarios and integration points, while unit tests should handle the majority of isolated functionality. A good test strategy balances both: unit tests for speed and coverage and E2E tests for user-focused validation.

Upvotes: 0

Mark Bramnik
Mark Bramnik

Reputation: 42441

The answer might seem subjective, but, its all about what you're actually testing.

If you test your code (you function gets x and y and produces z) - use unit tests. If you test a component in a real/semi-real environment - use integration testing. The component can be a microservice, a part of microservice, a DAO layer on backend - whatever you find useful.

Both should test that the programmer has actually done the coding right (unit) and that the code is supposed to work when not put into vacuum (integration test).

However both types of the test do not cover business flows of the system. This is a work for End2End tests.

These tests are an "automatic" representation of what used to be an regression test when QA guys run scenarios on the real system.

These tests usually go like:

  • Enter the screen X
  • Type this and that
  • Press the button ABC
  • Now you're on Screen Y
  • And so on and so forth as long as the flow-under-test is being checked

So I don't think that only Unit Tests can get you covered, and sometimes you also need E2E tests.

Upvotes: 2

auburg
auburg

Reputation: 1475

Your unit tests are low level tests presumably using mocks (i.e. for things like Rest calls, databases, file system etc) - you need high level end-to-end tests that exercise the system to make sure there's no integration issues on a deployed instance - the two complement each other and need to be done together.

Upvotes: 1

Related Questions