Contains the solutions to your testing problems.

234-page Ebook (Download as PDF, Mobi, EPUB) CGRT Slack access - chat with other Rails devs about testing Lifetime access
Trusted by 99 students

If you've tried to learn Rails testing, maybe you've been stuck on these common testing questions...



"What should I write tests for?"

You know you should be testing but you're not sure exactly what to test. The advice you've read doesn't seem to apply when the rubber meets the road.

How can I make testing a habitual part of my development workflow?

Maybe you conceptually understand how to write tests but you still aren't actually doing it. What's the difference between you and the people who write tests for all their code? Do they just have more discipline? What's the secret?


"What test framework should I use, MiniTest or RSpec?"

You know that MiniTest and RSpec are the two most popular testing frameworks for Rails, but you're not sure how to decide which one to use. There seem to be good (and strongly expressed!) arguments on both sides. How do you pick?


What level of test coverage do I need?

You've seen the tools that measure code coverage but you're not sure how much is really needed. 100%? 60%? 80%? Is there such a thing as too much testing?

Do I need to be doing TDD 100% of the time in order to be doing it "right"?

You've heard about test-driven development, and maybe you've even done a little TDD, but it's not clear how to do TDD all the time. Do you have to do TDD all the time in order to be a "real" tester? Is TDD even a good thing?


What are the various Rails testing tools and how do I use them?

Factory Bot, Faker, RSpec, VCR, WebMock... there are so many testing tools. What are they all for? Do you need them all?

Imagine what it would feel like to have really strong testing skills


You'd write tests as easily as you write regular code.

When you're comfortable with testing, you don't have to think hard about it. The tests just flow out. In fact, all your coding gets easier, because the tests you write help guide you forward.


You wouldn't have to force yourself to write tests because testing is just a habit.

To developers who are good at testing, writing tests isn't an extra chore. Writing tests isn't something they have to remember to do. It's just a normal part of the coding process. Furthermore, it's a fun and enjoyable part of the coding process.


You would choose your testing tools with confidence.

When you understand what the available testing tools are and why different teams choose different tools, it becomes easy to make the right choice for yourself. You can make the decision once and never worry about it again.


You would know how to do TDD and when to use it.

It would be 100% clear to you how to TDD any feature—IF you wanted to. And when you don't want to TDD a feature, you'll know why you're making that choice.

Introducing: the Complete Guide to Rails Testing


234 Pages, E-book Format



Contains the solutions to your testing problems


✅ What are the different kinds of Rails tests?

What are all the Rails testing tools and how do I use them?
✅ Which testing framework should I use (RSpec or Minitest)?
How can I make testing a habitual part of my development work?
✅ What level of test coverage should I shoot for?
How do I add tests to an existing Rails project?
✅ Much more

What's in the book


The different kinds of Rails tests
There are several different types of RSpec tests you can use. I show which ones to use and which ones to skip.

The various Rails testing tools and how to use them
Covers RSpec, Factory Bot, Capybara, VCR and WebMock.

How to decide which testing framework to use
Explains how to decide between the two big testing frameworks, RSpec and MiniTest.

How to make testing a habit
It's not enough to know how to write tests, you actually have to do it. I show you how to make testing a habit.

What level of test coverage to shoot for
Shows what level of test coverage to shoot for (hint: it's not a number).

How to add tests to an existing Rails project
Adding tests to an existing Rails project is a whole different ballgame from testing a greenfield app. I show you how.

How to set up a new Rails project for testing
I show you exactly how I set up all my new Rails projects.

How to decide when to do test-driven development
Are you testing "wrong" if you don't do TDD? I show you my approach to test-driven development.

Factory Bot
Installation, configuraiton, factory definitions, nested factories, traits, callbacks and transient attributes.

RSpec Syntax
Ruby blocks, let and let! vs. instance variables, describe and context, RSpec's DSL.

System Specs
When to write system specs, how to write system specs, a formula for writing system specs for most features.

Model Specs
What kinds of model specs to write and what kinds not to, the difference between testing implementation and behavior, much more.

Request Specs
What request specs are, the scenarios where request specs are useful vs. where they're not.

Mocks and Stubs
Test doubles, the difference between mocks and stubs, when to use mocks and stubs.

VCR and WebMock
Why to use VCR and WebMock, installation and configuration, how to use VCR and WebMock.


About The Author

Jason Swett
Jason Swett
Author of The Complete Guide to Rails Testing

Jason Swett is a developer, speaker, author of The Complete Guide to Rails Testing and host of The Rails with Jason podcast.

Jason enjoys helping other developers get better at programming through speaking and writing. 

He has spoken in several countries including the United States, India, The Netherlands, Bulgaria and Nigeria.

Jason lives in Sand Lake, Michigan with his wife and two kids.

Pricing

Get instant access & start learning right away

Risk-free 30-day refund policy. No questions asked.

Basic Package

What's included

  • 234-page DRM-free Ebook (Download as PDF, Mobi, EPUB)

  • CGRT Slack access - chat with other Rails devs about testing

  • Lifetime access

Pay once, own it forever

$49
30-day refund policy

Professional Package (for Teams of up to 10)

What's included

  • Access for up to 10 members of your Team

  • 234-page DRM-free Ebook (Download as PDF, Mobi, EPUB)

  • CGRT Slack access - chat with other Rails devs about testing

  • Custom invoicing for your financial records

  • Lifetime access

Pay once, own it forever

$199
30-day refund policy

Frequently asked questions

Can’t find the answer you’re looking for? Email [email protected] with your question.

What's the format of the book?
When you purchase, you get instant access to a web version of the book. You also get a zip file containing PDF, EPUB and MOBI formats. No print version as of now.
What testing frameworks and tools are covered?
RSpec, Capyabara, Factory Bot, and Faker (no Minitest). 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?
There's nothing in the book that's version-specific.
How long is the book?
The book is 234 pages long.
Is this a one-time fee or a recurring subscription?
This is a one-time fee. You will only be charged once.
How long will I have access to the content?
You will have unlimited lifetime access to the content. You can use it any time at your own convenience.
What happens if I'm not happy with my purchase? What is your refund policy?
We have a completely risk-free refund policy. If you're not happy with your purchase for any reason, you can get a full refund within 30 days of your purchase. Just email [email protected] with the email address you purchased with and your receipt number.

Ready to dive in? Get instant access right away.