Upcase header logo small

Learn with thoughtbot
Menu
×

Testing

A method of improving code quality and minimizing time required to add new features to software by ensuring that each facet of the program works as expected.

Trails

Testing

Testing Fundamentals

A method of improving code quality and minimizing time required to add new features to software by ensuring that each facet of the program works as expected.

?

A method of improving code quality and minimizing time required to add new features to software by ensuring that each facet of the program works as expected.

Exercise

Passing Your First Test

In order to get your feet wet with testing, let's write a test for a simple Ruby class.

Exercise

Testing ActiveRecord

In this exercise, you'll write an RSpec model test to verify a simple validation.

Exercise

Write an Integration Test

In this example, we'll be using Capybara to write an integration test.

Exercise

Write a controller spec

In this example, you'll write a unit test to make sure the create action for PeopleController works as expected based on the return value of save.

Exercise

Write A Feature With Tests

Time to put it all together! In this exercise, you'll add enhance a small Rails applications by adding the ability edit existing people. You'll implement the necessary actions and views in the Rails application, writing tests as you go.

5 steps remaining
Start trail
Testing

Test Doubles

Learn to use stubs, mocks, spies, and fakes with RSpec.

?

Learn to use stubs, mocks, spies, and fakes with RSpec.

Exercise

Simple Stubs

Use rspec-mocks to stub out an object in a test.

Exercise

Stubs with Constraints

Learn to set constraints on stubbed methods using RSpec.

Exercise

Setting Expectations with Mocks

Learn to unit test methods with side effects and mutation using mocks.

Exercise

Verifying Expectations with Spies

Learn how to keep your unit tests tidy with an alternative to mocks: spies.

Exercise

Testing Flexible Interactions with Fakes

Learn how to test complex or flexible interactions by using fakes.

Exercise

Verifying Mailers with Test Doubles

Now that you've learned how to use stubs, mocks, spies, and fakes, it's time to pull it all together.

6 steps remaining
Start trail

The Weekly Iteration

Ben Orenstein
Chris Toomey

Weekly Iteration

Route, Controller, Action

Ben Orenstein and Chris Toomey

In this screencast, Ben and Chris go back to basics and tackle the first...

Ben Orenstein
Joe Ferris

Weekly Iteration

Four Phases of Testing

Ben Orenstein and Joe Ferris

This episode covers one method of dividing a test into four distinct phases...

Chris Toomey
Joshua Clayton

Weekly Iteration

Page Objects

Chris Toomey and Joshua Clayton

On this week's episode, Chris is again joined by Josh Clayton,...

Ben Orenstein
Joe Ferris

Weekly Iteration

Integration vs Unit Testing

Ben Orenstein and Joe Ferris

Joe and Ben discuss the reasons for testing, and how integration and unit...

Joe Ferris
Gabe Berke-Williams

Weekly Iteration

Stubs, Mocks, Spies, and Fakes

Joe Ferris and Gabe Berke-Williams

Joe and Gabe review the four types of test doubles: stubs, mocks, spies and...