Get Lanyrd on your mobile (iPhone, Android and more) - check it out here

Your tests are lying to you

A session at RubyConf 2011

Mocks have an a bad rap lately. We've all seen brittle and unreadable test code riddled with 'should_receive' and 'mock_model', leading to classes people don't dare to touch. RSpec has now taken "mock_model" out of their default scaffolding for Rails controllers, and is preferring real objects. Does this mean that the concept of interaction testing is flawed?

Well designed code is easy to test, and mocks enhance your sense of smell. State-based testing will lie to you and hide your bad code for longer, but your interaction tests explode if you don't keep your code clean and your object collaborators few. That's as it should be.

Come to this talk if you want to hear a robust defence of mocks as a testing tool, see some examples of ruby code exhibiting the dangers of a reliance on state-based testing, and hear how you can use mocks to heighten your sense of smell, decrease coupling and increase cohesion.

About the speaker

This person is speaking at this event.
Chris Parsons

I try to solve problems for people, sometimes with code, sometimes with conversation. I try to listen. I make @soltdr and train at @bddkickstart. bio from Twitter

Coverage of this session

Sign in to add slides, notes or videos to this session

RubyConf 2011

United States United States, New Orleans

29th September to 1st October 2011

Tell your friends!

When

Time 5:15pm6:00pm CST

Date Fri 30th September 2011

Short URL

lanyrd.com/shzpq

Official session page

rubyconf.org/…s/12

View the schedule

Topics

See something wrong?

Report an issue with this session