7

JavaScript is everywhere right now. With the advent of jQuery and other associated JavaScript frameworks it's amazingly simple to add very powerful user interactions to web sites and web applications. However, with the addition of JavaScript and AJAX the movement away from HTTP and into a more asynchronous pattern has created new challenges.

Certainly you could use, Selenium. But what other frameworks have people used? I'm currently interested in things like:

4 Answers 4

4

I would recommend you taking a look at Jasmine if you like BDD style testing/specifications. Seems to be growing in popularity as well. There are a couple of screencasts on using Jasmine available on the net so you should have no trouble getting started. Check it out at: http://pivotal.github.com/jasmine/

3

I think qUnit is a popular test framework for javascript, though I haven't used it personally. jQuery uses it, though: http://docs.jquery.com/Qunit

3

I've been using zombie.js for headless testing. Unfortunately, it doesn't have all the nice stuff like Spies in Jasmine, but you might be able to use jasmine-node if you need that.

3

Why do you want to do headless testing? Is it purely due to the environment (such as I want to be able to run some automated tests on a build server that does not have a graphical subsystem)?

Regardless of the answer to the above, whatever solution you choose, the final target environment should shape your answer. For example, you could use the HtmlUnit WebDriver (http://htmlunit.sourceforge.net/). For my purposes, however, I would not consider using it since the underlying javascript engine is Rhino and none of my supported browsers use the Rhino engine. As such, any failures (or for that matter successful tests) will need an extra step to determine whether the failure is due to the java script engine used by the tool or due to a failure in the code or some combination of the two.

While not having a list of tools available for these engines, consider the tools that use the following engines if your target environment are in these browsers:

  • Chrome - V8 JavaScript engine
  • Firefox - Gecko JavaScript engine
  • IE9 - Chakra
  • Safari - WebKit

For testing these engines, I prefer to use the browser using Selenium.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.