Skip to content

TDD By Example

coloradokim edited this page Oct 3, 2017 · 7 revisions

Test Driven Development by Example

2015 Ember Conf Talk by Torin Billups

Notes

  • The purpose of TDD is to get feedback

Steps

  1. Create (or generate) an acceptance test
  2. Start with a high-level test (i.e. /) that mimics where the user might find themselves first
  3. The first test will be to find a group of items
  • Assert that a certain number of items will be returned
  • Build a route that will return the items
  • In the routes, return an array that is the same length as defined in your test.
  1. Once you get a passing test, add a new assert statement where you return sample data that you've hard-coded

Sage Advice

  • Use the red to get feedback, even if your tests don't go right from red to green.
  • If your red messages are different, it helps you figure out if you're on the right track
  • Client-side acceptance tests are all about the behavior of the app and your user, not the structure of your code
Clone this wiki locally