Test like an architect
Tags: testing, programming, productivity
Published: 2018-11-30 21:16:18

---
title: Test like an architect
published: true
description: Let's step into shoes of architects and try to make our software stable and reliable, the same way they build constructions
tags: testing, programming, productivity
cover_image: https://thepracticaldev.s3.amazonaws.com/i/wk0rlb4qv33h8ykmgpai.jpg
---
Most developers understand testing strategy as something which comes to the end of the development process and usually done manually by the developer itself or QA. Because not everybody sees a problem here, let’s take a parallel journey with architects and observe how they build a building. 
###Build a building like a software developer
Would you believe that architects build a whole building and then step aside and observe stability after construction worker did their job? Alternatively, build construction and then let it stay empty for a couple of months with test inhabitants inside. In that period architect can observe all factors such as stability, basic usability, material quality, etc. Then a couple of months later she/he introduces her/his building to the actual inhabitants and then, let them discover all malfunctions, problem, misplaced doors, not working electricity, etc. To don’t mention more serious problems they can find, such as way too thin walls, a floor which can’t handle the weight of their bookshelf, etc.
###Integration
Well, none of this happens in architecture, but it happens all the time in software development. I saw so many times software being developed, and first time tested after the development cycle being done. Architects do not do that. They have formulas and rules which make them put any construction on test way before they start to build it. Construction is made out of many pieces, concrete blocks, etc. All of this peaces put together interact whit each other and change the behavior of whole construction. Architects know exactly what is forces and momentums between two elements way before they put them together in reality.
This could be compared with integration tests in software development. You have a bunch of components which together should form a construction, every component may have different properties, but what is important is that output of one component is an input of a second one, and they should be in harmony
###Unit
Construction is made out of single elements. Every single element has his own properties. Architects know in advance what materials they can use, what is the projected weight of an element, what will be capacity and strength of every single element inside construction. This is something very similar to unit tests in software development. Unit test makes sure that every part of construction can handle tasks they are designed for. They are simple static formulas in architecture, which ensure that behavior of every single element stays same all the time. If you make one element weak, then your integration tests should show you a problem, but a unit test is the one which shows you exactly which single element is weak.
###Functional
Architects do not need an actual human to enter the building and start using it to discover that she/he puts power slots in places impossible to reach, doors which not going anywhere, windows which can’t be open. They have a set of standards for everything, electricity, placement of doors, lights, etc. Where standards do not help they can use common sense. Software developers can make a set of functional tests, which works with an actual database,  mimic user journey and predict common paths of users, way before putting software in actual use.

####Personal note
>I suffer on a daily basis because of zero tests included in projects I interact. Mostly this code was done in a rush and first time tested on production. Also, the leak of tests cost the company a huge amount of money + time, since they have to pay manual QA. I still believe we can learn something from pedant architects, not copy paste, but get some discipline out of that.