/robust-tests

JumpstartLab Training Course on Robust Testing

Primary LanguageRuby

Robust Tests

  • Refactor your code while passing tests
  • High coverage + low coupling
  • HTML is your only true API

I do

  • Post index
  • Create form
  • Write integration tests
  • Check coverage w/ cover_me
  • create via ajax - tests still pass

We do

  • add delete button and test
  • check coverage
  • delete via ajax

You do

Extract the post body (Easy)

  • store the body of the post in a separate model ... and don't change the tests
  • If you get stuck, git diff 05-extract-body

Sorting (Easy)

  • sort by name and sort by date - html with tests
  • refactor to do it with ajax

Editing (Medium)

  • Make an edit page to update a post
  • Then make it a pop-out form (on the index page) that updates via ajax ... and don't change the tests!

Filesystem store (hard)

  • instead of ActiveRecord and Sqlite, store the posts on the filesystem with YAML ... and don't change the tests!

Replace Rails (expert)

  • Use a different web framework (like sinatra, or even nodejs!)
  • Point selenium to a local port
  • Get the tests to pass without changing them