Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing the Untestable

Testing the Untestable

Given in 2014. Good tests are isolated, they’re repeatable, they’re deterministic. Good tests don’t touch the network and are flexible when it comes to change. Bad tests are all of the above and more. Bad tests are no tests at all: which is where I found myself with a 5 year legacy codebase running in production and touching millions of customers with minimal use-case documentation. We’ll cover this experience and several like it while digging into how to go from zero to total test coverage as painlessly as possible. You will learn how to stay sane in the face of insane testing conditions, and how to use these tests to deconstruct a monolith app. When life gives you a big ball of mud, write a big ball of tests

Richard Schneeman

November 21, 2016
Tweet

More Decks by Richard Schneeman

Other Decks in Programming

Transcript

  1. *

  2. MVP

  3. $ heroku run bash Running `bash` attached to terminal… ~

    $ ruby -v ruby 2.1.0p0 ~ $ rails -v Rails 4.0.2 Heroku run bash
  4. $ bundle exec hatchet install Installing repos for hatchet ==

    pulling 'git://github.com/sharpstone/ asset_precompile_pass.git' == pulling ‘git://github.com/sharpstone/ asset_precompile_not_found.git' # … hatchet install ~ 45 seconds
  5. $ bundle exec hatchet install Installing repos for hatchet ==

    pulling 'git://github.com/sharpstone/ asset_precompile_pass.git' == pulling ‘git://github.com/sharpstone/ asset_precompile_not_found.git' # … hatchet install ~ 2 seconds
  6. rake = LanguagePack::Helpers::RakeRunner.new .load_rake_tasks! task = rake.task("assets:precompile") task.invoke expect(task.status).to eq(:pass)

    expect(task.output).to match("success!") expect(task.time).not_to be_nil Finished in 1.63 seconds
  7. VCR