Testability is a really important topic for the future of testing. So much so that I believe that it's a really, really strong area for a tester to diversify into to remain relevant and have a major impact in an organisation. After all testability is for every discipline. If you said your mission was to build loosely coupled, observable, controllable and understandable systems, I know a few operations people from my past would have bitten both my hands off. Bringing various disciplines together is what a focus on testability can do.
It begins with powerful questions when it matters, in a feature inception or story kick off session. Asking this question can be really powerful:
How are we going to test this?
Its a great question, it has the "we" in there, which is a key part as an actor within a cross functional team. It also opens up the debate on the efficacy of testing on the thing that is about to be built, what types of testing are appropriate and enhancements needed to test it effectively (specifically for the types of testing that testers might do). This question often triggers challenges to enhancing testability which you need to be aware of. Have you ever heard any of these?
- Testability? That sounds like something that only testers should care about. As a developer why should I care?
- We are really keen to get this feature out before the marketing campaign. What does it matter how testable it is?
- We will think about testability later, when we have built something sufficient to begin end to end testing.
- We should focus on the performance and scalability of the system, testability is not as important as those factors.
- What I'd really like to know is how will testability make us more money and protect our reputation with our clients?
- You can't test this change. It’s just a refactoring, library update or config change exercise which shouldn't have a functional impact.
- We know its a really big change, but there is no way to split it into valuable chunks.
If faced with these, narrow the focus with questions such as:
- How can we observe the effects of this new feature on the existing system? (or how decomposable is it)
- How will we know the server side effects when operating the client? (or how observable is it)
- How will we set the state that the system needs to be in to start using the feature? (or how controllable is it)
- When we need to explain what the new feature is doing to a customer, can we explain it clearly? (or how understandable is it)
Great conversations often stem from the question, "how are we going to test this?" but being ready for the challenges that often occur and having focusing questions might be the catalyst take your testability to the next level.
Footnote and References:
Just so I'm clear, I mean this by the four keys aspects of intrinsic testability:
- Decomposable - The extent to which state is isolatable between components, thus knowing when and where events occur.
- Observable - The extent to which the requests, processing and responses of a layer or component are observable by the team.
- Controllable - The extent to which you can set, manipulate and ultimately reset the state of a layer or component to assist testing.
- Understandable - The extent to which the team can reason about the behaviour of a layer or component and explain it with confidence.
For more on the various aspects of testability (I mostly discuss the intrinsic with a bit of epistemic) have a look at the following blog with a few references to get started - http://testingisbelieving.blogspot.co.uk/2017/01/getting-started-with-testability.html