Articles | January 13, 2023

The test pyramid – what, when and how to test software to get profits

How to properly choose the right proportion of individual tests at specific levels to avoid unnecessary costs related to repairing the developed software – as well as making sure that the tests are worthwhile? Here’s where the test pyramid comes in handy.

pyramid

Software testing costs arouse a great deal of excitement. Despite the fact that “testing in production” has become a synonym for negligence, you can still find those who don’t feel the need to employ software testers. Software testing can be an unnecessary cost – but only if tests are run too late, they are unstable, of poor quality, or planned inappropriately. How to properly choose the right proportion of individual tests at specific levels to avoid unnecessary costs related to repairing the developed software – as well as making sure that the tests are worthwhile? Here’s where the test pyramid comes in handy.

What is a testing pyramid?

According to the ISTQB dictionary, a test pyramid is “a graphical model representing the relationship of the amount of testing per level, with more at the bottom than at the top.”

Simply put, the test pyramid shows us the right proportions among different types of tests, where the tests that are faster to perform, more stable, and therefore cheaper should be a foundation of the pyramid. Tests that take more time to prepare and run, are less stable and involve more human work should be on the higher levels of the pyramid.

Practical test pyramid

For newbie testers who take the first steps in software development project, testing pyramid is like a roadmap that defines test suite, clarifies how many tests should be performed and gives other tips for writing automated tests. But the clue of testing pyramid is return of investment corresponding with automation of tests. More tests on lower levels equal higher ROI. So the aim of test pyramid is to create a more reliable test suite. The order of testing can also impact its success and that of the Agile development project as a whole.

Modern software development organizations use testing strategy that defines test coverage and sets up a reliable test suite. The testing pyramid is a framework that illustrates testing strategy for the specific software development project. It grounds for fewer tests and facilitates increasing the efficiency in such techniques as Test-Driven Development.

In a general approach, the testing pyramid framework contains three main groups of tests. At the lower level, there are unit tests; integration tests are in the middle, and End-to-End tests at the top.

Also read: Why is software testing important

Test levels

Unit tests

Unit tests test single or the smallest elements, e.g. methods, or classes in the program. Most often, they are created by developers at the stage of writing subsequent sections of code. Unit tests are quick to run and they are the most common type of test (for example, when building a project). They are very important in the project as they are the best way to provide immediate feedback on whether a given function is returning the correct result. Therefore, most tests are unit tests, and they create the foundation of the pyramid.

unit tests

Unit tests are some of the simplest test classes of automated tests. To write tests for unit testing suite, there is no need to build sophisticated logic. Unit tests could be described with the use of the following advantages:

  • check particular elements,
  • fast feedback,
  • easy to maintain,
  • low maintenance costs.

Integration tests

Integration tests check whether individual modules, services or systems work properly together. They test the interfaces and interactions between these elements. Conducting tests of each integration point is, however, more demanding and therefore expensive – it requires running several application modules or even systems simultaneously.

Integration test is a more advanced test type than a unit test but is necessary for a whole test suite. As it is more complicated, integration testing involves more resources and knowledge to provide good quality of such service tests. Integration tests are characterized by the following features:

  • they check several modules or systems
  • more time-consuming than unit tests
  • higher maintenance costs than unit tests

End-to-end tests

E2E tests imitate the behavior of the end user. The tester takes on the role of the end-user and follows the same paths that they could follow. These tests check the end-to-end functionality and are performed in the target production environment. They check whether all systems and their components work correctly together and are free of errors. E2E tests are the most time-consuming, and therefore the most expensive, which is why they are at the very top of the pyramid.

  • they check the overall functioning of the system
  • time-consuming
  • more difficult and expensive to maintain

UI tests

User interface testing is a product testing process that verifies if the graphical interface complies with specifications. UI tests are at the top of the testing pyramid, so their automation should be well-planned. Because it is difficult to automatically test all application interface behaviors, it complicates the process of product testing.

The cost of software testing – how to test and not to overpay

What is the aforementioned cost of software testing? In a nutshell, time is money, and the more people get involved in testing, and the more time spent on it, the higher the total cost of the project. Moreover, the later errors are detected (as part of subsequent levels of testing), the later the developer will receive information about it, and the later he will get to work on fixing them.

For example, the causes of defects reported only during E2E testing are much more difficult to identify than those detected at the unit testing stage. This of course ultimately lengthens the overall timespan, and as a result, the cost of the project increases. By using the test pyramid method, the entire software testing process begins at the early stages of application development and testing is most frequent at these stages. Bugs found during unit testing are very easy to find, which expedites fixing them. Such an approach means that tests not only incur costs, but also bring real profits.

There are lots of automation testing tools available for web applications, and mobile application testing. Software testing tools make your work easier and save time. Keep in mind that different automation tools will perform better at different test levels.

Here are top 5 automation tools:

  • Selenium –  an open-source tool. Selenium also allows you to write tests in languages such as JavaScript (Node.js), C#, Groovy, Java, Perl, PHP, Python, Ruby, and Scala. You can run the tests in most browsers.
  • Cucumber – it is a tool based on Behavior Driven Development (BDD). It is typically used in real-time to write application acceptance tests. The Cucumber tool provides support for many programming languages, e.g. Java, Ruby, .NET, etc. It can be integrated with many tools, just to mention Selenium, Capybara, etc.)
  • Cypress – this tool allows you to automate user interface tests, and perform automated integration tests.
  • Appium – an open-source tool for automating native, web, and hybrid applications on iOS and Android platforms. Appium is cross-platform as it allows you to write tests on iOS and Android platforms using the same API.
  • Katalon Studio – a free automation testing solution. The software is built on open-source automation frameworks Selenium and Appium with an IDE interface for API, Web, and mobile testing.

Read also: End to end testing with Cypress

Testing strategy frameworks alternatives

For many different software development approaches (e.g. Continuous Integration – Continuous Delivery) there are several types of alternative frameworks including ice cream cone, the agile testing pyramid or test trophy.

External services

To ensure the best ROI, different teams use various testing strategies. One of the possible approaches to build a well-working test suite is to use external services. Outsourcing companies offer a vast range of contract tests in which flexible and on-demand cooperation models are some of the biggest benefits.

Is the test pyramid compliant with the agile methodology?

There are many significant advantages of test automation for agile teams. Agile processes emphasize speed and efficiency, and the agile test automation pyramid streamlines the entire testing process. Because the test pyramid is designed to start with the simplest tests, testers can achieve better results with more efficient task management. This priority control affects the quality of the final product.

Test pyramid model – summary

Hiring a software tester involves an additional budget – but this way we invest in the project on our own terms defined in the contract. In the event of a failure resulting from the late detection of defects in the developed system, the system itself becomes the master of our budget (and time) and we bear unforeseen repair costs, that can be even several dozen times higher than the costs of testing. In order for the testing to bring profits, it is worth starting software testing as soon as possible – the test pyramid method is priceless here, as it helps to properly plan tests at particular levels.

Tester with 5 years of experience. Wojciech started with manual tests, currently he also deals with automation. He worked mainly on web and mobile projects. After hours, he discovers the secrets of 3D printing.

Exclusive Content Awaits!

Dive deep into our special resources and insights. Subscribe to our newsletter now and stay ahead of the curve.

Information on the processing of personal data

Exclusive Content Awaits!

Dive deep into our special resources and insights. Subscribe to our newsletter now and stay ahead of the curve.

Information on the processing of personal data

Subscribe to our newsletter to unlock this file

Dive deep into our special resources and insights. Subscribe now and stay ahead of the curve – Exclusive Content Awaits

Information on the processing of personal data

Almost There!

We’ve sent a verification email to your address. Please click on the confirmation link inside to enjoy our latest updates.

If there is no message in your inbox within 5 minutes then also check your *spam* folder.

Already Part of the Crew!

Looks like you’re already subscribed to our newsletter. Stay tuned for the latest updates!

Oops, Something Went Wrong!

We encountered an unexpected error while processing your request. Please try again later or contact our support team for assistance.

    Get notified about new articles

    Be a part of something more than just newsletter

    I hereby agree that Inetum Polska Sp. z o.o. shall process my personal data (hereinafter ‘personal data’), such as: my full name, e-mail address, telephone number and Skype ID/name for commercial purposes.

    I hereby agree that Inetum Polska Sp. z o.o. shall process my personal data (hereinafter ‘personal data’), such as: my full name, e-mail address and telephone number for marketing purposes.

    Read more

    Just one click away!

    We've sent you an email containing a confirmation link. Please open your inbox and finalize your subscription there to receive your e-book copy.

    Note: If you don't see that email in your inbox shortly, check your spam folder.