Testing b4ad43a80bc6252cf5df2da75ef2818c03ca4364fd1ddd8b17194ab67ce1c9fc

Learn Testing

Test-driven development, or TDD, is the practice of writing your tests firsts, then using those tests to guide you as you write your actual production code. This may sound crazy, but it turns out that it makes writing code much easier. It provides a clear workflow and next steps while you're building and has the added benefit of producing a test suite you can have confidence in. With these courses and videos we'll teach you everything you need to know to get started with TDD.

With a solid test suite, you'll have more confidence every time you push a change up to production. You'll also be able to refactor with confidence, changing the structure of your application and remaining certain that all the important functionality still works. Even better, since TDD forces you to interact with your code as you test it, it provides great feedback as to when you might want to clean up some of the rough edges.

The aim of test driven development is to produce code that is as simple as possible in order to meet all required criteria, and many of our training graduates (and others who have learned these methods) find that it’s also a great way to produce very robust code. By its very nature the finished product has been tested rigorously by the time it’s ready to roll out.

We think that test driven development is a great skill for aspiring coders to have, and our tutorials are the ideal place to start. We begin by introducing the concepts and by the time you’ve finished the training, you should have a full toolbox ready to deploy TDD in the real world.

Trails

Testing

Test Doubles

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

?

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

Next Up

Simple Stubs

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

Unstarted

Stubs with Constraints

Learn to set constraints on stubbed methods using RSpec.

Unstarted

Setting Expectations with Mocks

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

Unstarted

Verifying Expectations with Spies

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

Unstarted

Testing Flexible Interactions with Fakes

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

Unstarted

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
Visit trail
Testing

Testing Fundamentals

So you want to get started with Ruby testing. All the cool kids are doing it. Seriously though, testing is fundamental. In this course of tutorials you’ll learn methods for improving code quality and minimizing time required to add new features to software by ensuring that each facet of the program works as expected.

?

So you want to get started with Ruby testing. All the cool kids are doing it. Seriously though, testing is fundamental. In this course of tutorials you’ll learn methods for improving code quality and minimizing time required to add new features to software by ensuring that each facet of the program works as expected.

Next Up

Passing Your First Test

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

Unstarted

Testing ActiveRecord

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

Unstarted

Write an Integration Test

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

Unstarted

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.

Unstarted

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
Visit trail

The Weekly Iteration

Hosted by

Ben Orenstein and Chris Toomey

Ben Orenstein
Chris Toomey

In this screencast, Ben and Chris go back to basics and tackle the first exercise in the Rails Fundamentals trail, "Route, Controller, Action". They create a route, controller, and action using TDD to tell them what to write next.

Hosted by

Ben Orenstein and Joe Ferris

Ben Orenstein
Joe Ferris

This episode covers one method of dividing a test into four distinct phases and the benefits of doing so. xUnit Patterns Wiki xUnit Test Patterns book

Hosted by

Chris Toomey and Joshua Clayton

Chris Toomey
Joshua Clayton

On this week's episode, Chris is again joined by Josh Clayton, Boston Development Director and TDD master, this time to discuss the power of page objects for cleaning up feature specs.

Hosted by

Ben Orenstein and Joe Ferris

Ben Orenstein
Joe Ferris

Joe and Ben discuss the reasons for testing, and how integration and unit testing each serve different reasons. Dive into the benefits of drawbacks of testing at each point in the isolation/integration spectrum by looking through examples.

Hosted by

Joe Ferris and Gabe Berke-Williams

Joe Ferris
Gabe Berke-Williams

Joe and Gabe review the four types of test doubles: stubs, mocks, spies and fakes. Learn what the key differences are between each type, as well as when you'd want to consider using them. See examples written using rspec-mocks, as well as an...

Hosted by

Chris Toomey and Joe Ferris

Chris Toomey
Joe Ferris

Tests are code too, and they deserve the same love and careful refactoring you'd show to your production code. In fact, there are a number of antipatterns and pitfalls unique to test code that can trip you up. Tune in to learn all the dos and...

Hosted by

Chris Toomey and Ben Orenstein

Chris Toomey
Ben Orenstein

Recently, we ran a group-coding app-building contest for Upcase subscribers. In this video, Ben and Chris review each of the submissions, both highlighting great aspects and suggesting some areas for improvement. Live code review at its finest!

Hosted by

Chris Toomey and Derek Prior

Chris Toomey
Derek Prior

On this week's episode, Chris is joined by Derek Prior to discuss Rspec's Bisect, a tool to track down order-dependence in your test suite and banish pesky intermittent test failures.

×

15 Full Courses, 100+ Screencasts & New Content Weekly