If you're looking for my old blog, it's been moved. Go to old blog →

5 Tips to start testing your applications today


help me by sharing on twitter

Start from the outside

Don’t start by testing small pieces. Instead, test the broader functionality of your app — in short, test your actions (in web development terms: test your actions / controllers). I’m not saying unit tests aren’t important, but they provide less coverage than broader, feature tests. While testing broader aspects of your application, you will definitely end up having to write some unit tests too, so that’s a plus.

Start with the most important features

This one may seem obvious, but when starting something we tend to try what feels easiest. In this cases, that’s a trap. Start by writing a list of 5 core features of your app and write complete tests for each one of them. Those should be the critical parts of your system and what you need to have confidence that works.

Make sure your tests actually test something

Specially when writing tests for existing code, one common thing that may happen is forgetting to test some parts – think things that happen inside a conditional, queued jobs, etc. My suggestion is to do what I call “reverse testing” — that is, commenting out some block of code and expecting some tests to fail. If you comment out a line on the tested code and the tests don’t fail, that means you are not covering everything and that you are still lacking tests.


Tests give you lots of confidence to refactor your code. If you are confident you have an aspect fully covered, you can also confidently make changes to it. Take that as an opportunity to not only test pieces of your code, but also improve them.

Ask for help

It’s very common not to understand some concepts of testing at first, I for one had some difficulties understanding mocks even after reading some articles. Not only that, but I was also embarrassed of asking for help. Don’t let that disturb your progress — there are lots of communities with people happy to help. Just ask!

If you came this far, I hope I helped you in some way! You can follow me on twitter to keep track of new things I publish 🙂

Keep track of my articles, tutorials and courses and receive valuable information directly in your inbox.

Thanks for subscribing!