Is there a testable architecture?

As I navigate towards other approaches of testing software, I see that there are some arguments in favor of testability. For example, cucumber names ports and adapter as a testable architecture [1].

In the fourth edition of the book “software architecture in practice” the chapter 12 dedicated to tetability elaborates on what might be a testable architecture and list its attributes rather than name a single architectural style.

The importance of listing attributes depicts a broader picture which leads to other architectures also being labeled as “testable” besides the ports and adapters.

In short, what the book depicts is a set of quality attributes that is the foundation to what is the book concept. Software architecture is made of attributes, those attributes are based on requirements that can be beyond the business requirements. Often the architecture besides tackling business needs it tackles complexity, tradeoffs, security, testability, scalability.

In that sense, answering the questions “is there a testable architecture?” becomes a questions that lacks structure from the start.

Let’s take the cucumber site as a basis to deconstruct to walk us through the gaps that the “testable architecture concept” has.

What is a testable architecture from cucumber website

In his talk (shared in the cucumber site) at Devlin 2017, Aslak Hellesoy shared what he thinks that makes a architecturable testable and the key points are the following:

  1. Inspire confidence
    • No test failing for some unknown reason
  2. lightening fast
    • Fast feedback with tests, if as a developer you have to wait a long time to have feedback, it impacts the delivery. It prevents improvements in the code base itself. Fast means under 15 seconds.
  3. Low cost
    • We are not paid to write tests we are paid to write features.

There are other things beyond

Often, Hexaggonal architecture is related to a “testable” architecture leading to developers to believe that MVC applications (or the layered) are somehow not suitable for efficient testing.

The book Understanding ASP. NET MVC by John Ciliberti label MVC app as a testable approach [2]. Indeed he highlights as this being an advantage of this style. The same happens to Nathan Rozentals in his book “Mastering TypeScript 3”, he states: “this MV* style of building applications also brings with it a huge advantage—the ability to write testable JavaScript. Using MV* allows us to unit test, integration test, and acceptance test almost all of our beautifully hand-crafted JavaScript” [3].

References

  1. [1]Cucumber.io, “Testable Architecture,” 2022 [Online]. Available at: https://cucumber.io/docs/guides/testable-architecture. [Accessed: 01-May-2022]
  2. [2]J. Ciliberti, “Understanding ASP.NET MVC,” in ASP.NET MVC 4 Recipes: A Problem-Solution Approach, Berkeley, CA: Apress, 2013, pp. 15–57 [Online]. Available at: https://doi.org/10.1007/978-1-4302-4774-6_2
  3. [3]N. Rozentals, Mastering TypeScript 3: Build enterprise-ready, industrial-strength web applications using TypeScript 3 and modern frameworks. Packt Publishing Ltd, 2019.