Define Testing Strategy using the Testing Pyramid

Colin But
6 min readAug 4, 2018

For a software project to succeed you need a successful strategy to testing. One way of doing this is to use the Testing Pyramid. Whether you are starting out a new software development project or working on an existing project, it is important to have a test strategy in place.

We all know it’s bad to not have any test at all but it is also bad to have useless tests. Partial tests, intermittent tests that fail for no reason, hard to maintain tests are just some examples of bad dev testing. We all know there’s different tests to put in place. For example, unit tests, integration tests, end-to-end tests, UI tests, API tests, component tests, service tests, system tests, and the list goes on.

So you start to put in tests for your code. But where do you start? How do you tackle it?

This is where a Test Strategy comes in.

In this strategy it is best to utilise the Testing Pyramid to help you define and categorise the different types of tests.

The Testing Pyramid

A testing pyramid is a pyramid of where all the different types of tests fits. The basic pyramid looks like this:

Very simple. 3 levels.

  1. At the bottom, is Unit Tests. These should count for the majority of tests you have for your codebase. They tests the smallest unit of code possible. Normally, only test a single method each.
  2. Middle level consists of Integration Tests which are tests designed to verify the integration of different parts of separate components of a software system together. This can be integration with a Database, with a Framework, with third party external software systems, or even with inter-software components between different layers (if you’re implementing a multi-layered software architecture software)
  3. At the top is the end-to-end tests which are tests that verifies the end to end workflows of your codebase. They tests the system from the user-action entry point right to the end of the system down to the database level. However, these are typically black-box…
Colin But

Writer sharing thoughts on pretty much everything. P.S. I’m a Coffee-Addict ☕ You can support me by buying me a coffee: