Rails Testing for Beginners

Rails Testing for Beginners

When you’re getting started with testing it can be unclear what to test and how.

As you try to write tests, you may find yourself thinking thoughts like this:

  • “I don’t know what to write tests for”
  • “I know I should be testing, I just don’t know how to get started”
  • “It takes me forever to figure out how to write each test”
  • “I wish there was a simple, repeatable process I could use to write tests”
  • “No matter how much I read about testing, I just don’t get it”

If you don’t write tests then you’ll end up dealing with the consequences of not testing:

  • Fragile, buggy code
  • A game of “whack-a-mole” – fix a bug only to introduce a new one somewhere else
  • Nerve-wracking deployments followed by firefighting and maybe even rollbacks
  • A bunch of wasted time and frustration when you do try (and fail) to write tests
  • A feeling of being “behind” as a professional
  • Lost job opportunities when employers want to see testing skills that you don’t have

What would life be like if you had the testing skills you wanted?

In you were a competent Rails tester then:

  • You’d always know what to write tests for
  • You’d write tests for features just as easily as the feature itself
  • You’d know the exact formula to write a test for almost any feature
  • Your base level of understanding testing principles would help you more easily absorb the arcane teachings of testing books and articles

And instead of dealing with the painful consequences of not writing tests, you’d experience the positive results that testing brings:

  • Robust, thoroughly tested code
  • Any regressions are caught automatically by the test suite
  • Confident, uneventful deployments
  • Enhanced productivity and cleaner code
  • The ability to refactor freely and make your code even more maintainable and robust
  • A feeling of being a competent professional
  • Enhanced career opportunities

Introducing: Rails Testing for Beginners

What’s Included

In Rails Testing for Beginners, I’ll walk you through the process of building a real Rails application with test coverage. If you’re new to Rails testing, don’t worry: we’ll ease into things by doing a couple “Rails testing hello world” exercises. Here’s a chapter listing.

Side note: when you purchase the book, you also automatically get access to the Code with Jason Slack group where you can get help from myself as well as your colleagues.

  1. Introduction
  2. The Path to Becoming a Confident Rails Tester
  3. My Rails Testing Workflow
  4. A Rails Testing Hello World
  5. A Rails Model Test Hello World
  6. Setting Up Our Sample Application
  7. Building Our First Resource
  8. Our First Real Feature Spec
  9. Our First Real Model Spec
  10. The Book Resource
  11. My Book Specs
  12. More Advanced Tests: Book Authorship
  13. My Authorship Test
  14. Orders and Line Items
  15. My Order and Line Item Tests
  16. De-Obscuring Our Tests Using Factories
  17. Feature Spec for Order Creation
  18. Where to Go From Here


How long is the book?

The book is 99 pages long.

What’s the format of the book?

PDF ebook. No print version as of now.

What testing frameworks and tools are covered?

Mostly RSpec, just because that’s what’s popular. Capyabara, Factory Bot, Faker and others are discussed as well. What’s more important than the testing framework or other tools though are the testing principles covered that apply no matter what set of tools you’re using.

What versions of Rails/RSpec are covered?

Rails 5.2 and RSpec 3.8.

What if I buy it and I don’t like it? Do I get my money back?

Yes. I offer a 100% no-questions-asked money-back guarantee.

About the Author

I’m Jason Swett. I’m a developer, speaker, trainer, author and host of The Ruby Testing Podcast.

I’ve taught programming classes and given tech talks all over the US and the world, including conferences like RubyConf India and teaching clients like Deloitte, VMware and HP. I’ve spoken or taught in India, Nigeria, Bulgaria and the Netherlands.

I’ve been coding Rails since 2011, writing tests for most of that time.

Want the Book?

Click the Buy Now button below for instant access to the Rails Testing for Beginners download. You’ll also receive an invite to the Code With Jason Slack group as part of your purchase.

Buy Now ($49)