How do I write tests?

Javier Lopez
Dev Genius
Published in
7 min readFeb 5, 2022

--

I started writing tests after learning to code. How to explain to someone that never wrote a test how to do it?. I will try to explain my approach.

First, perhaps I have to explain why I write tests. There are plenty of reasons, but the easiest one is to be sure that my code does what we want.
Following this reason, I will focus on testing public behaviors instead of internal things.
So I have to test my public APIs…

--

--