Testing Made Easier Via Framework Minimalism And Software ArchitectureAs with many other topics in software development, testing and test driven development are often made needlessly complex in theory and implementation by...
As with many other topics in software development, testing and test driven development are often made needlessly complex in theory and implementation by placing too much emphasis on learning a wide array of testing frameworks. In this article, we will revisit what testing means by a simple analogy, explore concepts in software architecture which will directly result in a reduced need for testing frameworks, and some arguments as to why you might benefit from an attitude of minimalism for your testing process.
Like many other Android developers, my initial foray into testing on the platform lead me to be immediately confronted with a demoralizing degree of jargon. Further, what few examples I came across at the time (circa 2015) did not present practical use cases which may have inclined me to think that the cost to benefit ratio of learning a tool like Espresso in order to verify that a TextView.setText(…) was working properly, was a reasonable investment.
To make matters even worse, I did not have a working understanding of software architecture in theory or practice, which meant that even if I bothered to learn these frameworks, I would have been writing tests for monolithic applications comprised of a few
god classes, written in spaghetti code. The punchline is that building, testing, and maintaining such applications is an exercise in self-sabotage quite regardless of your framework expertise; yet this realization only becomes clear after one has built a modular, loosely-coupled, and highly-cohesive application.
From here we arrive at one of the main points of discussion in this article, which I will summarize in plain language here: Among the primary benefits of applying the golden principles of software architecture (do not worry, I will discuss them with simple examples and language), is that your code can become easier to test. There are other benefits to applying such principles, but the relationship between software architecture and testing is the focus of this article.