I am currently developing a one page javascript application using Sinatra Ruby on server side and Backbone.js, jQuery, jQuery UI for the client side. The application main purpose is to allow a customer to view/edit different kind of items, each item view being a more or less complicated form.
To make sure everything works right I am planning to do:
What frameworks/tools do you recommend for integration testing in this case ? I started with Selenium but I didn't like it too much. I just started to look at PhantomJS and CasperJS and they seem pretty nice for basic stuff like navigating, clicking on links, ...
What's your advice ?
You didn't say what you didn't like about Selenium, but I'm guessing you are confident with JavaScript, so my recommendation would be to use CasperJS as the main tool. It does work well with one-page web apps, and comes with its own testing tool. The code can still get a bit convoluted at times, when using nested wait
clauses; deal with that by making sure you don't try to do too much in each test, and then if still complex, refactor. And don't forget design-for-testing: if your selector is horribly complex, consider adding a <span id="xxxx">...</span>
around it, so your tests can go straight to it!
You can use CasperJS with both PhantomJS and SlimerJS. My preference is for SlimerJS currently, as:
Once PhantomJS 2.0 comes out (around the end of 2013, hopefully), or if your site does not rely on any recent HTML5 APIs, you can run CasperJS twice, to get double coverage. (BTW, PhantomJS is naturally headless; SlimerJS needs to use Xvfb, which is Linux or Mac only.)
What Selenium gives you extra is you can control other browsers, IE in particular. (Though of course for IE you need to run a Windows machine.) Selenium, like SlimerJS, needs Xvfb to be headless (again, excluding Windows). (BTW, the Selenium docs on supported browsers has not been updated in ages, but I'm assuming later versions of each browser have at least the same support shown there.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With