News for hackers. Stuff that matters.

Ask HN: Help me start using test-driven design and development “in anger”

I've been programming a long time, so I'm not a novice and writing code from a blank screen, making it work, and deploying it in the real world. But I was around before things like "testing frameworks" and "Unit Testing Libraries." As a result I really don't know how to get started, "properly," with TDD.

Where do I start? What tutorial should I work through?

For the purposes I would guess the language I'd have to start with would be Python.

Help?

( 3 comments | on HN )
Re:Ask HN: Help me start using test-driven design and develo... by i0nutzb on Sunday May 03, 2015 @12:48PM (#9481995)
In order to do efficient TDD, you need to be fairly familiar with the SOLID principles.

I saw at least one book on O'reilly about TDD-ing in Python, but I can't really tell how good they are, since I don't do Py myself: http://chimera.labs.oreilly.com/books/1234000000754

However, if you are willing to invest few hours for watching TDD in other languages, I could recommend you these stuff:

1) https://code.tutsplus.com/courses/solid-design-patterns

2) http://www.jamesshore.com/Blog/Lets-Play

3) Clean Coders Series ( http://cleancoders.com/ ) - there are only few episodes strictly on TDD, but there are a lot of how and why on design patterns, principles and so on. (I'm doing PHP/JS, but I found Clean Coders - mostly Java - very helpful)

I just found this: https://code.tutsplus.com/tutorials/beginning-test-driven-de...

Re:Ask HN: Help me start using test-driven design and develo... by 271441 on Sunday May 03, 2015 @01:19PM (#9482112)
Thanks - I'll check them out.
Re:Ask HN: Help me start using test-driven design and develo... by sheraz on Sunday May 03, 2015 @02:29PM (#9482399)
I feel you. Only last year did I really embrace testing.

But I did it from what I call "outside-in".

That is, I started with acceptance tests and then worked my way down to unit tests. Search for "Accept Testing Driven Development."

Mostly my tools are Selenium for single page web apps that and codeception (php) for testing my APIs.

I find this method works well for me because it helps me to find the areas that actually needed the most testing. I didn't spend time writing unit tests for areas of code that were used only 1% of the time.

Also, it gives me a better understanding of how to bootstrap the entire infrastructure, which helps for setting up different environments (dev, staging, production).