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. 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 add tests to an existing Rails project Adding tests to an existing Rails project is a whole different ballgame from testing a greenfield app. 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 make testing a habit It's not enough to know how to write tests, you actually have to do it. How to decide which testing framework to use Explains how to decide between the two big testing frameworks, RSpec and MiniTest. The various Rails testing tools and how to use them Covers RSpec, Factory Bot, Capybara, VCR and WebMock. I show which ones to use and which ones to skip. What's in the book The different kinds of Rails tests There are several different types of RSpec tests you can use. It would be 100% clear to you how to TDD any feature-IF you wanted to.Īnd when you don't want to TDD a feature, you'll know why you're making that choice. You would know how to do TDD and when to use it. You can make the decision once and never worry about it again. 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 would choose your testing tools with confidence. It's just a normal part of the coding process.įurthermore, it's a fun and enjoyable part of the coding process. Writing tests isn't something they have to remember to do. To developers who are good at testing, writing tests isn't an extra chore. You wouldn't have to force yourself to write tests because testing is just a habit. In fact, all your coding gets easier, because the tests you write help guide you forward. When you're comfortable with testing, you don't have to think hard about it. Imagine what it would feel like to have really strong testing skills You'd write tests as easily as you write regular code. What are they all for? Do you need them all? What are the various Rails testing tools and how do I use them?įactory Bot, Faker, RSpec, VCR, WebMock.there are so many testing tools. 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.ĭo you have to do TDD all the time in order to be a "real" tester? Is there such a thing as too much testing?ĭo I need to be doing TDD 100% of the time in order to be doing it "right"? You've seen the tools that measure code coverage but you're not sure how much is really needed. There seem to be good (and strongly expressed!) arguments on both sides. 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. "What test framework should I use, MiniTest or RSpec?" What's the difference between you and the people who write tests for all their code?ĭo they just have more discipline? What's the secret? Maybe you conceptually understand how to write tests but you still aren't actually doing it. How can I make testing a habitual part of my development workflow? The advice you've read doesn't seem to apply when the rubber meets the road. You know you should be testing but you're not sure exactly what to test. The Complete Guide to Rails Testing If you've tried to learn Rails testing, maybe you've been stuck on these common testing questions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |