Topic: How to get into testing?

I've been programming in rails for around a year and a half now, but I have never touched the testing suite. I'm fairly used to testing things manually. I like the concept of being able to check that old features still work when one expands and application. I am wondering for someone who wants to get into testing, if I should just use the built in test suite (Rails 3), or get something such as cucumber and rspec. Suggestions on where to start such as a guide or tutorial would be helpful as well.

Thanks smile

Re: How to get into testing?

I am in the same boat and am looking for a place to start. Any advice/insight would be greatly appreciated.

Re: How to get into testing?

Why don't you start from books or articles that describe this process?

Re: How to get into testing?

You could start with the simple option and use the built in suite. If you aren't doing any automated testing right now, this will give you a taste of the kind of freedom you have to refactor your code when you have the support a suite of tests that can check all your code in a matter of seconds.

Remember though that you have to be as rigorous about maintaining test code as you are with your live code. You must be disciplined about keeping all the tests decoupled and using DRY principles - otherwise it will become more and more of a hassle to maintain your tests, so you won't run them very often, and before you know it you are back where you started.

Re: How to get into testing?

I recently got through http://railstutorial.org/book which uses rspec and I must say it was a great intro into testing. It starts with small things like how to test if response is successful and then slowly builds into more complex tests.

I definitely recommend reading that book.

Re: How to get into testing?

I started testing with Cucumber and this was for me a good start: http://railscasts.com/episodes/155-begi … h-cucumber

Re: How to get into testing?

andain wrote:

I recently got through http://railstutorial.org/book which uses rspec and I must say it was a great intro into testing. It starts with small things like how to test if response is successful and then slowly builds into more complex tests.

I definitely recommend reading that book.

I recommend this book too... It shows the reader how a skilled pro handles rails development (tests included).
I also recommend reading some stuff about BDD and TDD, understanding why you have to test code it's an
enlightening experience.
I find learning what "test" means really hard. This is because behind such a simple and humble word there
are years of evolving concepts and development theories...

Re: How to get into testing?

andain wrote:

I recently got through http://railstutorial.org/book which uses rspec and I must say it was a great intro into testing. It starts with small things like how to test if response is successful and then slowly builds into more complex tests.

I definitely recommend reading that book.

+1

The difficulty i found with getting my head round testing wasn't rpsec syntax but how or why you decide what to test. The railstutorial stuff helped far more than any introductory tutorial as it showed how the author managed his workflow. It made understanding the 'why' of testing a lot clearer