Why TDD?
by Chance Smith
Incase you haven’t heard we first we need to talk about what Test Driven Development (TDD) is.
TDD?
It’s a seemingly simple workflow. you just write tests first and then write code that passes your tests. Just one at a time. Yeah, sounds nuts. So dumb, right?! Let me explain the steps…
- RED: Write a failing test
- GREEN: Write just enough production code to past that test
- REFACTOR: Refactor any of your code without failing a test. Stay green.
These steps are all thanks to Kent Beck and Uncle Bob. Go read their books. Back to TDD…
This is a simple but challenging process. You will struggle, but with much software enegineering maturity you will get better at this. Start now. Worry about doing it wrong later.
Why you need TDD
Let’s list the ways:
- less browser refreshing, because your tests are testing that part of the code for you
- run your code less, because your tests are testing that part of the code for you
- let the failing tests show you what to go fix or add next
- refactor or abstract anything you want, just keep the green lights on
How do I start writing tests?
Go Google “How to write test in python” or “Javascript TDD.” Watch and read all you can.
Here is a collection of testing videos that our team found helpful to get us started.
Also use Katas, the act of practicing to memorize and perfect a form or movements. Katas work in development and help us get into a new programming language and especially learn to test our code. Here is a small javascript todo-list kata our team created and talk about often of how we add tests to frontend logic and UI.
Go write some tests
I’m going to say it again…
Start now. Worry about doing it wrong later.
Need help getting started
Our team would be happy to help you get started when testing Python, C#, or Javascript.