The first time I ran an end-to-end test of a web service I was developing I had tears come up to my eyes from joy and relief. You can feel like that too. If you always write at least one end-to-end test as soon as you start developing a new project or a module in your project. Why?


Because even in the early stages of development it will save you a lot of headaches and time: you won’t have to check manually if things work every time you make changes to the code.

I shed a tear every time I think about how much time I’ve spent in my early dev years having to run the code and check that things work every time I changed an env variable name or fixed a bunch of linting errors.


  • by being lazy like that, you’ll join the high echelons of programmers who have the test framework always set up and ready to accommodate more tests when you feel fancy enough to add some
  • if you’re anything like me and you tend to postpone writing tests on hobby projects, following this principle will help you conceptualize the problem as not-a-big-deal-at-all since you only promised to add 1 test (the rest will eventually follow)

What kind of test to write?

For a front-end, it’s nice usually nice to have some kind of simple click-through with a login step (if your application consists of such) and making sure that all the views/pages are accessible and rendered. For a micro-service or an API, it’s great to have it accept some data and check the response or that it saved things in the database correctly.

Remember git hooks

You got this far in automating something that takes your time unnecessarily. Then why run the npm test command manually? Husky makes git hooks simple and fun. You just write a simple script, call it pre-push and your tests will run automatically before the code gets pushed to the remote.

Remember Docker

Synchronizing applications and services for testing can be a headache so make sure to have a nice and clean docker setup so you can easily spin up containers that depend on each other for testing purposes.

And if you’re not on the Docker train yet, you should definitely incorporate DevOps skills into your practice. It’s a must.