Application Testing with Capybara

When you have a non-technical background, terminologies about “testing” may confuse you. Ash Maurya suggested that we should “prefer functional tests over unit tests” under circumstances that we need to skip writing tests. He actually meant “acceptance testing” as he later mentioned Selenium on the book “Running Lean”. Terminology confusion aside, he still made a good point that even if you’re running out of time, it is probably not worth it to skip writing acceptance tests.

There aren’t too many books for Ruby solely focused on acceptance testing. I have read about 4 books focused on acceptance testing to date including the book Application Testing with Capybara. In fact there aren’t too many books on acceptance testing regardless of the language. I believe it has yet to be embraced by more developers.

The book is focused on how to use Capybara for acceptance testing regardless of whether you are using Sinatra, Ruby on Rails or any Rack-based DSL. If you are more familiar with Cucumber, you probably already know that Cucumber with Gherkin language alone is gibberish and Capybara does the real work.

At some point in the past, I expressed how I hated Cucumber and used Steak for some Ruby on Rails projects. Steak uses Capybara.

Application Testing with Capybara

Testing with Capybara may be too simple for a typical Rubyist with a year experience but there are so many test frameworks and changes in the Ruby language itself. There so many Capybara drivers that most of us are confused on what to use. We definitely need to read a resource that has most of the information we need about Capybara.

If you are still learning Ruby, I see no real difficulty in understanding the book. The author clearly explained about installation of gems and dependencies needed. I think the examples would pass for a good introduction to Sinatra if you have yet to try it out.

If you have experience with Capybara, this book is still worth reading. I honestly haven’t tried all of the Capybara drivers. It’s not a breeze to use Selenium but it still seems to beat PhantomJS. Please tell me it’s not just me.

The book has an entire chapter on “Dealing with Ajax, JavaScript and Flash.” I find it really helpful. If you have tried unit testing JavaScript with Jasmine and you liked it but then found it insufficient overall for a Rails app, you should use Capybara.

Check out the book and judge for yourself: Application Testing with Capybara.