I never write tests

Hi! My name is Flávio and I’ve never written any tests. And I come here so you can guide me on how to start writing test for existing applications.

I currently have 3 applications running and none of them have tests. Two of them are because we didn’t have the time or man power to do. We were in a very tight schedule and the other one because the app was already built when I came on board and I just mantain it and add features and hope nothing breaks.

Now I realize that it’s very important to have tests but all I see are guides/screencasts on how to TDD but I’d like to know how/where I start writing tests for my existing apps.

Thanks in advance.

Hi @massayoshi.

I think a classic recommendation is reading Working Effectively with Legacy Code by Michael Feathers.

In your position, I would start by adding feature specs around the app, to start to understand how the system works end to end, probably around the main user flows.
Once that first safety net is in, I’d start getting down to writing unit tests.

Hope this helps :smile:

5 Likes

@massayoshi,
If you don’t want to take the time to write a ton of tests all at once then my suggestion is, write a test for the section you are currently working on. When you touch a class add test coverage. When you touch a model add test coverage. Doing this will keep it from being a huge monumental task and slowly you will build up the coverage that should have been there.

2 Likes

Thanks, guys. I have some new features to add and will try that and I’ll get back to you!

Feel free to pm me and I will do a TDD session with you. Ruby Ruby Loveliness.

We will use minitest, because i like small and I hate dependencies.

:smiley: