From the course: Ruby: Testing with RSpec
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Writing good tests - Ruby Tutorial
From the course: Ruby: Testing with RSpec
Writing good tests
- Throughout this training title, we're going to learn to write good tests. But in this movie, I want to start you off with some good general advice on how to write good tests. The first question asked about how to write good tests is, what should you test? There's an old programmer joke about what parts of your application need test coverage. You only have to test the parts that need to work. Now, of course, we want our whole piece of software to work, which implies that we need to test everything. In truth, it's actually a matter of personal preference and comfort level. How much test coverage do you need to feel comfortable that everything is working properly? It also depends greatly on the complexity in each part of your application. If I'm writing a web form that allows users to sign up for a newsletter, then I'm going to write very little test coverage for it, because it's a pretty simple task, and it's not that mission critical. But if I'm going to write a web form that's going…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.