Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber and Rspec

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..

like image 443
Ashish Avatar asked Mar 03 '11 12:03

Ashish


People also ask

What is RSpec in Cucumber?

RSpec and Cucumber are both testing frameworks. RSpec includes traditional Unit Testing (which means testing a class or part of the application in isolation from the rest of the application. So your model does what your model is supposed to do, the controller does what it is supposed to do, etc).

Is RSpec TDD or BDD?

RSpec is a Behavior-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.

What is RSpec used for?

RSpec is a testing tool for Ruby, created for behavior-driven development (BDD). It is the most frequently used testing library for Ruby in production applications. Even though it has a very rich and powerful DSL (domain-specific language), at its core it is a simple tool which you can start using rather quickly.

What is RSpec and capybara?

Capybara is a framework which allows us to test the code in our views by filling in form data, inspecting page content and sending HTTP requests to the browser. Let's set up a spec to test our newly created form: rails generate rspec:feature form. This will generate the file spec/features/form_spec.rb .


3 Answers

I think the RSpec Book is an excellent resource on Cucumber, RSpec and BDD.

like image 170
sorens Avatar answered Oct 14 '22 11:10

sorens


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.

like image 5
Grant Sayer Avatar answered Oct 14 '22 11:10

Grant Sayer


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!

like image 2
benoitr Avatar answered Oct 14 '22 13:10

benoitr