Automated testing and agile software development often appear in pairs, but automation in agile is often easier said than done. Most developers have realized the benefits of test automation: it speeds up testing, reduces costs, increases coverage, and so on. However, many people never exceed the initial investment required to get started. Just like the caveman in this cartoon, many teams are in trouble. They adopt inefficient methods because they think they have no time to make changes. In fact, they themselves are harmed. Don't develop this bad habit!
Today, I will share with you one of the best testing practices for agile teams.
How to start? How do you know which areas to focus on? Which test scenarios should be automated? In non-agile software development, many people inadvertently fall into the test of the "ice cream cone anti-pattern" because this pattern places more emphasis on automation at the UI level. The Abstracta team prefers the mode of turning the ice cream cone upside down-a popular method promoted by Mike Cohn, the Agile Test Automation Pyramid. It can bring maximum benefits to automation costs, increase the rate of return on automation investment, and ensure that you will get the maximum benefits from automation.
When most of our work is focused on UI-level automation, the focus is on finding errors; for the Agile Pyramid, the focus is on avoiding errors.
In the image below, you can see the difference between the two methods.
Basic layer: unit testing
Obviously, in the pyramid (as part of the best testing practices for agile teams), most of the testing should be done during the development phase, with unit testing after each build. These tests are the easiest, lowest cost and fastest to complete, and are an important aspect of test-driven development. Running more tests at a lower level allows us to check the corresponding work during the run, get immediate feedback, and let the team know exactly where the error is when it is difficult to hide. Here, the life of these errors will also be shorter, and they may occur and be cleared in less than a minute. In the UI test process, errors will survive longer and produce more intense conflicts because they have been comfortably present for a relatively longer period of time.
Middle layer: API/integration/component testing
After running and passing all unit tests, you can enter the API/integration/component testing phase. The integration test is run to ensure that all components work together properly. Here you can test most of the logic and business processes without going through the UI, and it is best to use automation as much as possible here. If you are entangled in whether to automate here or at the UI level, choosing here will have fewer problems, easier maintenance, faster test execution (meaning you can find errors faster and shorten their lifespan), and you can test the logic of the system . These tests are slower and more complex than unit tests, but they are still faster and less fragile than UI tests.
Top layer: UI testing
Last but not least, UI testing is the one that runs the least. It’s best to do as few UI tests as possible because they are expensive, difficult to prepare, difficult to maintain, and take a long time. In this step, just make sure that the user interface itself is working properly and all other aspects of the system have been tested. Only the most important part of the end-to-end test is tested. The process starts with the user login and ends with a final operation such as a transaction success message. It is also helpful to focus on things related to the browser or UI. After running the UI test, you can perform manual and exploratory testing (as shown by the shape of the sphere above the pyramid).
As mentioned above, compared to focusing on automated GUI testing and inadvertently following the "ice cream cone anti-pattern", the pyramid method is a more powerful, beneficial, and cost-effective way to automate testing. The pyramid provides a strong foundation in the unit testing stage, which can be further tested in the integration and UI stages, while the ice cream cone method is more top-heavy and less stable.
In order to stand out in the agile development world, it is necessary to follow automated pyramid testing to produce the best quality software possible. But you don’t need to follow only one family, you can refer to the materials and practice continuously to obtain the most suitable testing method for the team.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。