The hardest test to write

I build meaningful software by empathising with design, development and business needs. My interests are test automation, functional programming and full-stack web development using NodeJS and other tools.
Search for a command to run...

I build meaningful software by empathising with design, development and business needs. My interests are test automation, functional programming and full-stack web development using NodeJS and other tools.
No comments yet. Be the first to comment.
Being able to safely refactor code is one of the greatest benefits of writing tests. The goal of refactoring is to improve code design e.g. style, design patterns, performance. Let's take an example from the previous route handler which has already b...

Marginal gains ⚙️ The 2020 Summer Olympic Games were held in Tokyo between 23 July and 8 August. The enduring motto of the Olympics is “Faster, Higher, Stronger”. From 1908 to 2003 the British cycling team won only 1 gold medal at the Olympics. This ...

This is a scenario that took some time to understand. I could see errors in the browser but everything on the server seemed to be configured correctly. The problem was, that when a request was made by the browser, the server handling the request made...

Florida and Minnesota each developed their Statewide Automated Child Welfare Information System (SACWIS). In Florida, system development started in 1990 and was estimated to take 8 years and cost $32 million. As Johnson spoke in 2002, Florida had spe...

Why a health route? I want to begin with the end in mind. When our API is deployed in a cloud environment, the automated, cloud deployment will need a way to know that our API has started correctly. That is the purpose of the GET /health route. I hav...

I like writing tests, because they prove the code will run like I expect. I like it even more when I can write tests before I write code. But often I can’t do that, because I'm still figuring out how the code will work. To put it another way, I'm not sure where I'm going, so how can I ask for directions?
Another challenge is when there is already some code in place that was not written with tests in mind. The code is written like a black box, giving out no secrets, taking no prisoners or arguments. That's why tests should be written first.
Sometimes, I convince myself that it's quicker to do manual tests by refreshing the browser or repeating the commands in the terminal. Then I realise that I'm making slower progress, because automated tests are much faster and less error prone than manual tests.
Do I want to spend my time writing log statements and stepping through breakpoints? No, this sucks, but the alternative is that I'll have to set up Jest, Mocha or Cypress.
Setting up tests is a one-off toll to get on the highway.
Eventually, I find my way. Either the path becomes clear and I know what I'm aiming for, or I'm tired of repeating the same actions over and over - code, run, check, code, run, check. And I commit to writing the first test.
Code, check, repeat.