Technologies

John Firebaugh john.firebaugh at gmail.com
Thu Sep 13 04:05:32 BST 2012


I was the contributor who suggested introducing Capybara-based integration
tests. I've used them in the past and found them very helpful. It's
possible to use Capybara without Selenium, but I've found that most often I
needed a driver that supports JavaScript, and I needed to be able to see
and interact with the page when something goes wrong, which was a
disadvantage with headless drivers. It sounds like the consensus is to
avoid Selenium at this time -- that's fine (though I'd be curious if those
that have used it in the past were using something like Capybara, which I
find lessens the pain quite a bit).

However, I think it is important that we start to get our JavaScript under
test, at least at the unit level. I suggest using
Konacha<https://github.com/jfirebaugh/konacha>,
a JS testing harness that I created and maintain. It's similar to Jasmine,
though better integrated with the Rails asset pipeline and built using a
newer, and better engineered, generation of JS testing libraries,
mocha<http://visionmedia.github.com/mocha/>and
chai <http://chaijs.com/>.

Here's an example of what Konacha tests look like:

https://github.com/jfirebaugh/openstreetmap-website/blob/28f40ba13bcb1c6fc4ae66cf6377def559ed73a2/test/javascripts/params_test.js

Tests run in the browser -- while developing, re-running is as simple as
refreshing the page. For CI, you can run them with Selenium or any other
driver supported by Capybara. Check out the Konacha README for more details
and let me know if you have any questions.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20120912/f657a03b/attachment-0001.html>


More information about the rails-dev mailing list