Can anyone suggest me good source (Easy examples) for cucumber and rspec tutorials (rails 3)???
Edit:
Actually I am looking for free online resources with good examples..
I think the RSpec Book is an excellent resource on Cucumber, RSpec and BDD.
Agree - the RSpec Book provides a wealth of information. I found getting the flow was a big problem in the learning. The book gives you the quick intro, then dives into details and by the time you surface your head will be swimming. It takes a couple of goes of reading the book to get the finer points.
Another great read is a blog post by Sarah Mei called Outside-In BDD. This dialog really help to make things gel since it's demonstrating the application of Cucumber/Rspec in the context of the flow a developer would go through.
Then there is the classics such as the Railscast from Ryan Bates. There are a couple of episodes on Cucumber and other tools and the snippets give you a nice overview after you've soaked up the RSpec book.
For Rspec you can read the Michael Hartl book "Rails 3 tutorial" there is a lot of testing examples : Here the online book
For cucumber, you can watch teachmetocode screencasts (website) . There are good examples using cucumber when building an application from scratch.
Hope it could help!
Screencast walk-throughs can be good sources to grok them
Peepcode has a few, like this one on Cucumber, which has been updated this year - so I'm assuming it's good for rails 3
Related
I'm trying to learn to do TDD. I'm having difficulty though, finding out what exactly it is I should be testing for each action in a RESTful controller. What I really would like is a sample of the most basic spec for a RESTful controller, which would help me figure out what I should be testing. If it matters, I'm using RSPec with Capybara. I'm not looking for something I can crib, just a sample I can examine so I know whether I'm going in the right direction.
There was an answer here before that got deleted, and the user suggested the Rails tutorial. It was pretty good for learning what to test, and can be found at http://www.railstutorial.org/book with chapters three and nine being most useful for someone just looking at it for TDD purposes.
Since then I've also found an older article that's really handy combined with the tutorial (and a bit of digging), simply because it's now highly out of date. This is found at the Everyday Rails blog, at http://everydayrails.com/2012/03/12/testing-series-intro.html.
Ultimately it looks like there may not be a good, solid, easy tutorial on how and what to test for Rails 4 with RSpec 3. Perhaps something you pros could consider!
Is there any comprehensive guides on testing rails apps. Im searching for guide that will tell me what should I test and how should I test it especially with Rspec. Lots of examples will be appreciated.
The RSpec Book
Testing the rails app is part of development so I'd sugest to read Ruby on Rails Tutorial, Learn Rails by Example by Michael Hartl, it has good explained testing process.
The Rails Guide A Guide to Testing Rails Applications is a good place to start.
It covers the default test/unit style of testing.
As suggested by #megas, the RSpec book is another place to look.
Agile Web Development with Rails is a great first book for any rails developer, covering the full process of building an application, testing it as you go.
Also take a look at Railscast as well.
Some episodes that talks about testing:
Episode 275: How I Test
Episode 257: Request Specs and Capybara
Episode 158: Factories not Fixtures revised or Older Episode
Episode 261: Testing JavaScript with Jasmine
Check out Everyday Rails Testing with RSpec. Sumner does a great job of walking you through writing tests for an entire app. The Hartl book is also a great resource.
After finishing with Rails Tutorial by Michael Hartl, which parts of the sample app proposed in tutorial should I upgrade first? Authentication method comes to mind first..
Given the huge popularity of that tutorial, I suppose there is something like a list of steps to be taken for that app to become more up-to-date in this ever changing world of web dev etc. etc. etc.
Overall is it a good idea to use that app as a foundation for building something more advanced?
Thanks in advance!
I learned Rails with that book :)
However, even the authentication algorithm used there is great to learn, in practice you can use other alternatives. For example I use the wonderful Devise gem (Railscasts 209 and 210).
There are some ideas at the end of the book that explain how you can extend the application. However, I think that building your own app from scratch is better now that you know how to do it.
After reading that book, I created some basic projects, and in parallel started reading The Ruby Programming Language and The Rails 3 Way.
Hope it helps! Welcome to the Rails world :)
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
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
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.
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.
I want to start BDD on Ruby On Rails what should I learn?
I don't know anything about BDD, RSpec or Cucumber. What is the best way to learn? Tutorials? Something that cover things like 'What behavior I should test?' etc.
thanks!
RSpec specific; I keep these links for reference (might be advance for beginners). But just wanna share it with you. (Some of it probably already outdated but I think still worth a read)
Rspec Link Fest - links to other references
RSpec in Controllers:
Testing your Application Controller with rSpec
Testing Controllers with rspec
Using Rspec on Controllers
RSpec in Models:
stub_model by Dave Chelimsky
Do we really need Controller and View tests? - some discussion
RSpec in Views:
RSpec testing views for escaped HTML
Rspec Stories (now Cucumber):
Understanding RSpec Stories - a Tutorial
Rspec on Windows:
RSpec, autotest and Snarl on Windows - dunno if this still relevant
p/s: Some are from 2007, I'm not sure if the stuffs are outdated or not, but these are the some of my references used to learn RSpec. Hope it helps
Start with two articles by Dan North: Introducing BDD, followed closely What's in a Story?
Start at the top, RSpec home page:
http://rspec.info/