Unit Testing good study material

  • Thread starter Lakshmanan Muthukrishnan
  • Start date
L

Lakshmanan Muthukrishnan

I am a beginner in ruby and I have read the "Unit testing" chapter in
Programming Ruby book. I want to study Unit testing using ruby in much
more detail.

Can somebody point me towards a good resource for that ?

thanks
 
R

Rick DeNatale

I am a beginner in ruby and I have read the "Unit testing" chapter in
Programming Ruby book. I want to study Unit testing using ruby in much
more detail.

Can somebody point me towards a good resource for that ?

you might want to google for a few terms related to that like

TDD (or test driven design)
or
BDD (behavior driven design)

I'd recommend "The RSpec book" from the Pragmatic Programmers which is
currently in the last stages of their beta program, which means that
you can buy the book as a PDF and optionally get the printed book when
available.

http://pragprog.com/titles/achbd/the-rspec-book

As the name implies the book covers rspec rather than test::unit.
RSpec has become a very popular alternative to test::unit for many
Rubyists. It also covers Cucumber which is a higher level framework
for writing user-level specifications/acceptance tests. The pair work
very well in combination.

There's also another pragmatic programmers title in beta "Rails Test
Prescriptions" by Noel Rappin.

http://pragprog.com/titles/nrtest/rails-test-prescriptions

This was a self-published book, which focused more on Test::Unit, but
included material on RSpec/Cucumber. It's been picked up as a title
by the prags, I believe that it's more focused on Rails than the RSpec
book, which covers the use of RSpec/Cucumber with Rails apps in the
context of doing BDD in Ruby, whereas the Rappin book looks like it
covers the use of RSpec and Cucumber as an extension of the Test::Unit
based testing framework in Rails.

HTH

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
 
J

Josh Cheek

[Note: parts of this message were removed to make it a legal post.]

I'd recommend "The RSpec book" from the Pragmatic Programmers which is
currently in the last stages of their beta program, which means that
you can buy the book as a PDF and optionally get the printed book when
available.

It's been in the last stages of beta for a really long time now :( It's
release date has been pushed back at least three times this year already.
There was also supposed to be a book on RSpec by Apress but it seems nothing
ever happened with that (it is alleged to already be released
http://www.amazon.com/Foundations-R...1_fkmr1_2?ie=UTF8&qid=1275903384&sr=1-2-fkmr1)
And Addison-Wesley was supposed to release a book on it back in April,
but
that hasn't happened and the book's page is now gone from Amazon. Back in
Feb I was asking about these books (
http://www.ruby-forum.com/topic/204576) Noone really had much to say.

I enjoyed your blog about creating your own RSpec book from the beta PDF. (
http://talklikeaduck.denhaven2.com/...letely-different-diy-bookbinding-on-the-cheap)
And I have it since my boss pre-ordered. But I have a hard time motivating
myself to try and read something that I feel like is going to be deprecated
soon. I won't have the time or motivation to read it twice.


@Lakshmana: the first chapter of Ruby Best Practices is about testing
(Test::Unit) the book is not really aimed at people new to Ruby, but it has
a lot of code examples, and you can download the PDF for free from
http://rubybestpractices.com/ (if you're satisfied, you can support Open
Source and the author, by purchasing it
http://oreilly.com/catalog/9780596523008/index.html) Although, I just
glanced at the Pickaxe's chapter on unit testing, and I'm not sure whether
RBP has more to offer (still, free to check it out). Still, don't get hung
up on whether you understand every nut and bolt of everything. The Pickaxe's
chapter looks like it should be good enough to get started, and it is more
important that you incorrectly start, than that you correctly do not start.
Once you get started, you'll have a better understanding of the domain,
which will make it easier to learn from reading other resources later down
the line. In other words, you can begin testing with just a bare minimum of
tools, and you should.

RSpec's documentation is also pretty good http://rspec.info/documentation/

And I feel like I ...oughta... mention shoulda, b/c there are a lot of
Rubyists who like it, but I honestly know next to nothing about it, so I'll
let someone else fill in those details. Here is their github, though (
http://github.com/thoughtbot/shoulda).

I also feel like I should mention that there are two Peepcodes about RSpec,
but a lot of the stuff in them is already deprecated and doesn't work, and
it's especially frustrating when learning the unfamiliar, if you don't
really know what something does, but it isn't working, and you aren't sure
why not, or how big of a deal it is. NOTE: I just went to check it out, and
they now have 4 peepcodes on BDD, including cucumber and mocking. The ones I
watched say they have been updated, but I'm not sure if that was before or
after I tried going through it. (http://peepcode.com/)
 
R

Rick DeNatale

It's been in the last stages of beta for a really long time now :( It's
release date has been pushed back at least three times this year already.


It suffers from the same fate as many books for Ruby, which is chasing
a moving target.

The current delay is that it was decided to delay the release until
RSpec 2 is released, which is also being coordinated on the release of
Rails 3.


Even in its current 'beta' form it's quite complete and useful.


--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top