Unit Tests, UI Tests, Integration Tests & End-To-End Tests


Lawrence Tan
3 min readSep 19, 2019
A strong software is made of reliable pillars of tests.

As we write more sophisticated software, we want to be confident that our application continues to work as we add new features and/or refactor our codebase.

In this Testing Pyramid, which was introduced by Mike Cohn, re-designed by Marin Fowler and re-engineered by me, summarises the essential types of tests a software should have. Let me put them into two main categories:

1. Programmatic

Programmatic Tests help us to ensure our business logic works.
i.e. validations, calculations, sorting order, etc.

Unit Tests

Unit Tests sits at the base of the Testing Pyramid. This means they take lesser time to code and classes that you are testing should be more isolated. For example, a Login Feature normally has Validation and Authentication logic. They should be written in two separate classes like LoginValidator and LoginAuthenticator. Based on these two classes, you write test scripts.

When you try to test Networking functions, like in LoginAuthenticator, you should use Mock Response to test for both positive and negative responses.

Integration Tests

Integration Tests sits at the next level after Unit Tests. Here, you will use Real Network Responses, by hitting the real server endpoint, and test that the small units you have written are able to work together.

2. Interaction

Interaction Tests help us to ensure our Application Interaction works by simulating them using native or third-party tools.

UI Tests

UI Testing automates repetitive tasks to ensure that your most critical UI interactions keep working as you’re adding new features or refactoring your app’s codebase. It may also help new developers to understand the app as they just need to run the UI Test once, he is able to see the…



Lawrence Tan

Googler. Loves God, Loves my wife, Loves my Family & Corgis.