How to Build a Testing Pyramid with Success
Led by the experience, I strongly believe that people who are working on setting up the CI, the pipelines, and the people who are in charge of setting up the testing pyramid should work closely together. And, it’s not enough to have all levels of testing. You need to have an infrastructure to help you know when you’re going to execute these tests. CI/CD tools play a major role here. They provide us with the infrastructure so that we would know which test is going to be executed at any given moment and what value we are going to get from it. The ultimate goal here is to raise the quality of software and one of the most important things is something we like to call code coverage. We try to get a certain percentage of coverage with a lot of tests, whether these are unit tests or some other levels of testing. But, when it comes to testing pyramids, I think a smart code coverage is more important than a certain number. Meaning that it’s quite important for the team to know that we are not testing the same thing twice with unit integration or even three times. We really want to split the responsibilities between developers and QA engineers and always have optimal level of testing and optimal number of tests. Finally, I think all of these things couldn’t be done without the infrastructure for testing, and those are test environments. From my experience, when we talk about traditional regular web applications, having two test environments is really important to get the biggest value from the testing pyramid. This way you enable your team members to optimize the scope of testing to have the customizable scope and to locate specific types of tests to the specific environment. This allows you to slowly grow to the production environment and gain confidence along the way to move on. In the image below, we can see a simplified testing pyramid. I think every team should make it simple. And we can see the broader scope is at the top and the narrow one is at the bottom. With narrow scope we are actually talking about the unit test. With unit tests we are testing classes, we are testing modules, even objects independently. And then, we can move up to the pyramid and follow its shape. It’s called a pyramid for a reason. We can see that the biggest amount of tests are at the bottom. This is because unit tests are run quickly and they’re easy to maintain. It’s cheapest to write the unit tests and compare them to the higher level of testing, such as acceptance tests, where we have even UI tests. These are not easy to maintain, they’re slowly executed, and they are more prone to failure than unit tests.
Testing Pyramid
Broader scope at the top and narrow at the bottom Follow the shape of the pyramid QA responsibilities API testing: – bypass the presentation layer – less expensive to write and maintain – generate data for UI test UI testing: – cover just the best-case scenarios– use for critical paths
– time factor
Enterprise solutions and startup culture