Testing Pyramid: What Is It and How To Use It

Testing Pyramid: What Is It and How To Use It
By Bogdan Rutskov, Head of Development and Maksim Sarychau, Test Automation Engineer

Does your new software application project require QA and software tests, but you don’t know how or where to start? Do you expect top quality and high testing ROI? 

As a rule of thumb, your team should use a software test pyramid.

Read how the test automation pyramid and relevant automation tools for agile testing may become game-changers for your project and what benefits they might yield.

What is a Test Pyramid?

The test pyramid or a test automation pyramid is a great visual model that demonstrates the various layers of QA testing: Basic Unit Tests, Integration Tests, and UI Tests. Engineers that use Test Pyramids use them to group test cases based on the level of test granularity and within a single QA project. 

Having all levels of automated tests grouped correctly within your project makes the development and QA processes highly resultative: 

  • Test automation ROI grows in proportion to test complexity. 

  • The amount of mandatory manual testing is greatly reduced.

  • Testers spend less time on simple tasks.

  • QA engineers create more reliable test suites. 

  • Developers may focus more on building high quality software solutions.

You need all three types of tests involved in your testing strategy to maximize your ROI.

test  automation pyramid

It must be said, that in addition to the tests presented in the plan, agile teams also employ acceptance tests in production environments. Such testing is applicable at any project stage to assess how well an individual element and/or an entire application works from a user's perspective.

Acceptance tests also help verify if an application meets client guidelines. We’re going to dwell on these tests in our next article. 

As an application development and testing process advances, the number of tests reduces while their complexity grows. Likewise, the test automation ROI soars at the highest testing level. Now, let’s go from the bottom to the top of the pyramid. 

Base Level: Unit Tests

Your project requires unit tests to cover every single line of an application's code and every branch of the conditions tree when possible. Development teams, not QAs, employ unit tests to check separate code chunks that will be released to production environments. They can make a quick verification and receive immediate feedback on the functioning of some of the changed parts.

What Are Unit Tests?

Unit tests are the most basic yet indispensable way of testing. Writing and implementing them is the basic approach to testing individual functionalities and application components and checking how they work in an isolated environment. The tests usually come into play during an application building process.

The limited possibilities of unit test suites are sufficient for verifying the quality of static code. Developers run these tests as often as necessary in order to make the code bug-free.

Unit Test Toolset

Regarding Java application development and testing, developers use frameworks and libraries to cover some individual components of business logic with unit tests.

JUnit framework provides simplified yet sufficient functionality to write tests and run them at the Unit Test level. Occasionally, JUnit is not sufficient to meet testing needs, and developers may employ TestNG. It provides extended functionality such as parallel testing in multiple threads, test groupings, and the creation of test dependencies.

JaCoco, a free Java code coverage library, helps developers trace the percentage of code covered with unit tests. When the test coverage minimum is not met, the build fails. JaCoco also provides comprehensive human-readable coverage reports.

Developers need tools to verify the behavior of objects that have external dependencies on other parts of an application. To that end, they use testing libraries and isolate entities under testing by creating mock objects that simulate how real objects behave.

Mockito is a pretty concise library that helps cover 95% of unit testing needs. Sometimes its functionality might not be enough, for instance, to cover static methods. Thus, developers may use a PowerMock that extends the functionality and helps create proxy stubs for static methods, constructors, private methods, and more.

In rare cases, software developers might use the Spring framework. If an application is Spring-based, developers might use a Spring Test module to create end-to-end unit tests, mock objects, and more. Although Spring functionality is usually redundant, the framework might offer some extra opportunities for unit testing if needed.

It's no secret that the most popular Java framework for enterprise application development is Spring. If an application is Spring-based, developers might use a Spring Test module to create end-to-end unit tests, mock objects, and more. It provides a convenient way to start up an application context to be used in tests.

Middle Level: API or Integration Test Examples

Application Programming Interface (API) contains business logic, which makes API or integration testing a high priority. According to Statista, developers spend 29.5% of their time building APIs, and testing is equally as time-consuming. 

What Are Integration Tests?

API or Integration tests are designed to verify how code chunks interact and integrate with such external components such as databases, APIs, and similar.  

QAs don’t need to run integration tests as often as unit tests. Such tests are time-consuming to run as they interact with external services. They check if the software communicates efficiently with an API, sending a correct call and receiving the correct status and data.

Testing Integration With External Services

API testing might be confusing when, for instance, you have to handle the complicated nature of fintech projects. Financial solutions are designed to comply with security requirements and industry regulations and are often non-transparent. They contain sophisticated banking and finance information that is important to understand before testing starts. Before testing starts make sure that guidelines, manuals, and API testing requirements for your engineering team are as clear as possible.

The use of legacy infrastructure and outdated tech stack is one of the biggest mistakes when testing API. You should equip your development team and QAs with up-to-date tools and highly detailed fintech API testing documentation in order to avoid any possible redundant explanations.

When it comes to integration testing of complicated applications like those for the fintech industry, it’s best to be meticulous. Pay close attention to the tool choice and adequate adjustments to your API testing strategy. With everything prepared and set  properly, you should expect to get outstanding results.

Top Level: UI Tests

Interface or end-to-end tests are on the top of the pyramid. QAs run high-level software tests to ensure the proper functioning of an entire application. 

What is UI Testing?

This type of testing allows QA and test automation engineers to uncover and fix flaws that might substantially impair application functionality and performance. UI tests are designed to emulate the most probable user interactions with an application under testing. They are complicated to create and execute as they cover an enormous amount of different real-life interaction scenarios.  

UI design elements should be structured in such a way that your application will allow users to access everything they need easily. UI mistakes affect customer turnover and diminish the level of user trust in a provider of business. End-to-end or interface tests are time-consuming to write but may ensure the greatest ROI compared to automated tests at lower levels.

UI Automation Testing Tools

Solvd test automation engineers use a proprietary testing framework called Carina and, less often, Cypress, together with Selenium and Appium for UI testing. 

Carina is a Java-based framework that is effective for automated testing of web and mobile applications, REST services, APIs, and databases. It is created on the basis of such popular open-source solutions as Selenium, Appium, and TestNG and can replace complicated technology stacks.

The framework is cross-platform, works with all types of popular browsers and mobile devices, and supports multiple databases. It allows reusing up to 80% of test automation code between IOS and Android. Besides, Carina integrates with another proprietary tool by Solvd, Zebrunner, which provides in-depth test analytics and interprets and visualizes the test results.

Cypress is a JavaScript framework that is excellent for end-to-end testing of web applications. Its latest architecture allows testers to run it in a browser alongside an application, access test elements, and execute testing quickly.

This framework allows for control over network traffic, the behavior of elements, testing timings, and server responses. It ensures real-time support and it can take test snapshots. 

Selenium has already become a testing industry standard. This open-source UI test automation tool is perfect if you need to automate test scripts and run them within different operating systems. It fits in with multiple third-party development environments and it also works with modern programming languages. 

The tool supports cross-browser and parallel execution of tests both on local and remote devices via the Selenium server. It integrates easily with CI/CD tools and other frameworks. 

Appium is probably the best tool for testing the UI of native, web-based, and hybrid mobile applications. It allows test engineers to write tests and run mobile iOS and Android testing by using the Appium cloud. 

It supports multiple programming languages and allows reusing test scripts across platforms. Appium can be used with CI/CD tools and various frameworks and it supports testing on real devices and emulations. 

Importance of Testing Pyramid in Automation Testing

The pyramid usage and agile testing boost the productivity of your software developers and QA testers and also positively impact the overall software project costs.

  • Savings in Time

For a standard project, automated testing scenarios take 3 hours to run versus  1 week for manual QA testing for the same amount of scripts. On average, 1 to 2 days are required to complete automated regression testing. Automation Testing is a solution that gives you 24/7 testing support. It can be easily integrated into the deployment process and allow for automatic triggers.

  • Reduction of QA Costs

Solvd clients can see a 35% reduction in QA costs due to test automation. Using test automation tools both saves valuable resources and lowers the risks of costly product glitches. A fail fast technique allows for quicker changes and often made before releases, which helps minimize customer churn and any related financial losses. However, minimal manual testing presence remains mandatory for some of the project parts.

  • Application Quality Improvement

Test automation minimizes human errors and helps catch bugs easier and faster before they reach production. It expedites CI/CD lifecycle and frees up engineers' time from beta-testing new features. Releases can be rolled out weekly instead of monthly.

  • Facilitated Software Engineering

Test automation helps diminish the number of bugs by 20-30 times and keeps it lower than 10 per release. Software developers can focus more on building features instead of wasting their time on fixing bugs.

  • Productivity Boost

With automated tests in place, your engineers can work together as a team to build better products. It allows scaling up testing efforts as a business grows since a limited amount of manual QA is needed.

The use of the test pyramid by agile teams is very advantageous as it streamlines the testing process and highlights the amount of testing necessary at one or at many development levels. With the correctly selected tools and tests done by our QA professionals, you may rest assured that your investments will have a handsome return, and your application will become a valuable asset for your customers.

Bogdan Rutskov
Bogdan Rutskov
Head of Development
Bogdan Rutskov, Head of Development, earned his Bachelor's degree from BSU. He has six years of experience working on various projects as a Java software developer and test automation engineer. His favorite project is Zebrunner – one of Solvd's proprietary test automation tools – where he was fortunate enough to work as a full-stack developer.
Maksim Sarychau
Maksim Sarychau
Test Automation Engineer
Maksim Sarychau graduated from BSU, worked as a system administrator, programmer and designer, and after taking a test automation course in 2003, got his first job in testing. He is a professional in Java, Ruby, C#, Node.js and Carina, to name a few, and has contributed to creating several new test automation frameworks.

Tell us about your needs