Inverting the Test Pyramid

The pyramid model for test automation devised by Mike Cohn recommends adoption of three layers of tests for the right automation mix. Unit tests at the base of the pyramid take up most of the automation testing work, followed by the middle layer consisting of integration or service level tests. The uppermost layer is the thinnest comprising GUI tests.

In reality, this model represents an ideal state and most teams begin with an inverted pyramid state that exists in the traditional test automation model. As they embark on Agile, the need arises to work their way towards “flipping” the pyramid to reach an effective automation state. In this post, let us look at what it takes and how this can be achieved.

The goal of getting to the desired pyramid state requires a structured and methodical approach and sufficient time before the changes start becoming visible. The road to the straight pyramid should commence with considerable thoughts and planning for some key aspects mentioned below:

  1. Defining a test strategy: considering the technical and business needs, the test strategy includes identifying the different types of testing needed and mapping them to the different layers of the pyramid, assessing the tools and framework to adopt, and defining frequency of test execution at various stages in development.
  2. Assessment of the current state: here, we consider various aspects such as the number of tests that exist in each layer, their stability and reliability, coverage for critical scenarios in the acceptance layer, and what support exists for the system till sufficient tests are built in order to assess current state.
  3. Incrementing the test base systematically: the approach to increasing the test base needs to take into consideration handling of changes to legacy code as well as new feature development. Teams need to discuss how and what they would cover with each new feature coming into their sprints. Coverage for legacy code will take longer as the test base is built gradually, as and when the code is modified or refactored. Adoption of Test-Driven Development (TDD) will be worthwhile to consider here.
  4. CI strategy: here, the focus lies on identification of tools and infrastructure needs, what tests to integrate with the build process to help provide early feedback, and selecting a frequency for the execution of different tests. For instance, unit tests can run with every build, integration and acceptance tests can be scheduled at regular intervals.
  5. Test auditing: without regular assessment and reviews, aspects related to test duplication, code coverage and deprecation of unwanted tests will be at risk, negating the entire effort to move towards the desired pyramid model. The frequency and scope for the reviews needs to be identified.
  6. Cultural changes: scripting tests needs to be treated like coding and requires the culture and mindset of teams to adhere to this approach. Having the right team that works together to automate tests, supported by appropriate mentoring and leadership is key to achieving success. Identifying and baking this mindset into the culture of the organization is very important.

Rajeshwari

The above considerations need to result in concrete plans and processes that will guide the teams towards building the right automation structure. Slowly with time, a gradual shift in the pyramid will be evidenced. During this transition, support from management and business owners will be essential as the journey can be challenging.

For instance, as the initial period could see some slowdown in the velocity of deliverables, investment needs for tools and CI harness may delay sought ROI. Once achieved however, the pyramid model will see many significant benefits such as better test coverage, lower maintenance costs, short feedback loops, and the entire team’s involvement in automation, support for continuous delivery and overall commitment to quality.

By Rajeshwari Sundararajan on Mar 3, 2015 6:44:08 AM

Rajeshwari is Senior QA Manager, Ness Bangalore. She manages QA, Performance Engineering, Release and Configuration management functions. Rajeshwari has extensive experience in leading teams in successfully transitioning from waterfall model to continuous delivery in Agile. One of her key focus areas in this journey has been test automation and challenges of moving towards a pyramid model without compromising on delivery quality.

0 Comments

Words: Test Pyramid

Sign up for our Newsletter