Seth Vargo 1/12/2013

Unit Testing Correctly

Read Original

This technical article critiques a flawed approach to unit testing in Ruby, using a web scraper class as an example. It argues that tests involving network calls and file I/O are slow, unreliable integration tests. The author defines true unit testing, emphasizes isolating the 'universe' under test, and provides a refactored example using test doubles (mocks and stubs) for dependencies like URI and Net::HTTP.

Unit Testing Correctly

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week