Testing is widespread in the Rails community, which is awesome. For most new developers, learning to test is not simple. New developers often think testing should come naturally if you can code well. I mean, I wrote the code, I should be able to write a test for it, right? Over the past 2 months at thoughtbot I’ve come to learn why this is false and now I’m learning to test.
Testing is like any other skill, you have to practice to get good at it. Good test driven developers use previous experience to figure out what tools to use when presented with new challenges. Don’t get discouraged when you don’t know how to test something, just take a step back and evaluate the problem. Improving your testing skill also requires discipline and persistence.
No matter how dedicated you are to testing, there are times when it will slow you down. At that point, its really easy to skip testing, just this one time. It takes discipline to make sure that doesn’t happen. Take the extra time, invest the extra effort and find out how to test it, and then in the end your development process will speed up.
The Rails community has tons of people willing to help. If you get stuck on testing something, Google first, then check out the Rails forumsor the Rails IRC channel. Don’t hesitate to comment on blog posts which come close to solving your problem, but fall short. I’ve found the Rails community to be very helpful so don’t be afraid to ‘drink from the firehose.’
Learning to be a good at test-driven development is hard, but being a developer is hard in general and testing skills must be practiced. Once you start writing tests more regularly, you also learn how to write code that isinherentlyeasier to test. I joined apprentice.io to become a great developer and learning to test well is half the battle. It’s ok to suck at testing when you begin, but practice makes perfect. A great place to start learning is ourIntro to Test Driven Rails Workshop, we have a course coming up later this month. Soon enough, you will think in tests before thinking in code.