Software Developer wisdom has it that problems with testing point to problems with your architecture. If tests are hard to write, brittle, kludgy, brain-bending to create: that is what software people call a “smell”: an indication that something might not be quite right.
In this case, it’s the architecture. Testing troubles often point to weaknesses in the architecture which make it hard to come up with good tests.
However, if you consider architecture closely: it has two dimensions!
As first, as the thing we usually think about, you’ve got the technical dimension: how the different aspects of your technical infrastructure, of your stack, fit together.
And secondly you’ve got the functional architecture. In other words: how the different functions and use cases of your product fit together.
While there’s a great deal of discussion about the first kind of architecture, the second one is maybe overlooked a little more. This is a shame, since not only do they both exist, they are often intertwined.
Be aware that the tests will also give you feedback along those two dimensions.
If you have trouble coming up with good tests for elements of your technical infrastructure, then maybe your technical architecture is not ideal. So far, so good.
If, however, you are having trouble coming up with good tests from a functional or user acceptance perspective, that may well point to problems with your functional architecture, with the structure of your application from the user’s perspective.
And there’s something else interesting about this: if you think of Conway’s Law, you realize that architecture cannot be separated from team organization and organizational structure.
So if you’re struggling with creating good functional or user acceptance tests – well, maybe it is because that’s just something difficult to do.
However, maybe it’s also a sign that your functional architecture is troubled, and you should look at how your entire product fits together, indeed how your teams work together.
I think this particular aspect of product smells, as opposed to the more traditional code smells could bear some more thinking about.