My 2 Cents on "On the Diverse And Fantastical Shapes of Testing"

I want to share my cents about the post: "On the Diverse And Fantastical Shapes of Testing". First of all, I believe this is a very interesting subject and yet still see very few engineers talking about it. People mostly take tests for granted. Secondly, I would like to acknowledge the parts I agree with on this post mainly around the concept of Sociable and Solitary Unit Tests are quite useful and show be widespread. Also with the need for teams to have reliable, fast, Bounded(Isolated) and not Flacky on Justin tweet. Now that I acknowledge that, let me elaborate on what I think we are missing and why IMHO the pyramid is dated and we need a mentality shift. I have 4 points I want to elaborate on and give more context.

I expressed these ideas before on this blog posts and if you more details and more context:

http://diego-pacheco.blogspot.com/2021/02/testing-in-production.html

http://diego-pacheco.blogspot.com/2020/08/hardening-prodution.html

http://diego-pacheco.blogspot.com/2020/03/pipelines-from-cicd-to-self-operating.html

http://diego-pacheco.blogspot.com/2020/02/going-faster-with-testing.html

TL;DR; It's about having a bigger test diversity and shifting our mindset to hardening production rather than trying to predict all possible failure modes. 

#1 - Engineering Evolution - frontend, mobile, data, ops, etc

Test Pyramid was great but also dated. Today we have other fields of software engineering much more evolved them before such as Frontend Engineering(look React, Vue, Angular) look micro frontends and module federation, Mobile with IoS, Flutter, Dart, React-Native, look Server Driven UI for instance, Big Data or just Data with Streaming(Spark, Flink, Kafka Stream), Machine Learning and let's not forget about Ops(or like some folks call it DevOps or SRE) with plenty of infra and automation work - such as Terraform. 

Engineering had evolved in so many specialized fields than the generic full stack developer or classical and only backend work tends to fade in big companies. Things are much more specialized now and software is much more distributed thanks to cloud computing, edge computing, blockchain, IoT, and the trend if to have more distribution not less. 

As we have more distribution(look Microservices and Serverless also) - Unit Tests and Integration tests cannot be the only form of testing and we also need to acknowledge that because of the complexity of the systems we have we need more them testing. 

#2 - Limits of pre-production testing - Triggering failure modes and recovery from them

Pre-Production testing has limits. The classical test pyramid aimed at pre-production testing. Pre-production testing still will exist forever probably but it has limits. As we have more and more distribution and specialized software in different places(#1) we can't predict all failure modes. It is very hard to replicate and maintain pre-prod envs. So how we reproduce important failure modes? With classical test pyramid approach will be hard because we need more tests. We need a modern approach with Chaos Engineering, Observability, Testing Diversity, and more. 

#3 - Observability, Chaos Engineering, and understanding

Observability is about understanding and having better systems. How much does the Test pyramid talk about that? Chaos Engineering is about recovering from failure and testing your infra and software to make sure they are anti-fragile, you can't do that with unit and integration tests. 

We need a wider spectrum considering not only pre-prod but also prod(pre and post-deploy). Testing needs to be blend with Observability and Chaos Engineering. In the end, Observability is not that different from testing but how it works is pretty different. In the end, what we need is a better understanding of production systems and hability to recover from failure and that's very different from the classical pyramid mindset. 

#4 - Waste, Mindset(Hardening production), and Diversity

All Forms of testing have WASTE. Unit Tests can suffer a lot from Mocks and that could be a smell. Integration tests can be expensive, flaky, and also full of waste. A % or specific test coverage means nothing in this sense since you can't give this number to different services and different pieces of software considering frontend, backend, data, and ops. it's also very hard to measure and therefore we have WASTE there.

What we need is a mindset shift where we need to harden production and always make production better.  IF the code is not in prod is a waste. Lean is all about production and reducing cycles and deploy often to production. It's getting harder and harder to simulate failure in pre-production. In the end is all about diversity, having more forms of testing with a wider spectrum, not a pyramid. 

Cheers,

Diego Pacheco

Popular posts from this blog

Kafka Streams with Java 15

Rust and Java Interoperability

HMAC in Java