persian
persian

Reputation: 91

writing test for rubyonrails

I am new to writing test for rubyonrails app like rspect, steak, cucumber etc. How do I start or learn so that it will help me to write beautiful codes?

You can give some simple example or some url where I can understand from zero.

Thanks

Upvotes: 2

Views: 403

Answers (3)

cwadding
cwadding

Reputation: 870

1) Start by reading the rails testing guide just to get a feel for testing.

2) Become familiar with the various testing frameworks (Cucumber, rspec, testunit, steak, minitest), watch screencasts (railscasts, TeachMeToCode) and then try and choose one that appeals to you.

3) Write tests!! and get help as you need it from StackOverflow. If you like RSpec then the RSpec book is very helpful, but not essential.

My personal opinion on frameworks: I started out really liking cucumber but I eventually found it very verbose and I didn't like using it for my integration tests and then RSpec for my unit and functional tests. I now like using just RSpec with Capybara and Shoulda matchers. TestUnit can be even less verbose than RSpec but personally I find RSpec to be the happy medium between writing self documenting code and not being overly verbose.

Upvotes: 1

Vladimir Tsukanov
Vladimir Tsukanov

Reputation: 4459

http://railscasts.com/episodes/155-beginning-with-cucumber - a good podcast for beginner

The RSpec Book - also very useful

It's a good point to start and then Google help you

Upvotes: 1

bassneck
bassneck

Reputation: 4043

I've just started with RSpec a few days ago and it was pretty hard (it still is actually). You could start from railstutorial.org. The author follows the TDD principle. More info available at RSpec and Cucumber github page. Be sure to check out the wiki.

Upvotes: 0

Related Questions