Web App UI Test Automation with jQuery vs. Selenium and Watir

I am currently working on an article for Microsoft’s MSDN Magazine that describes how to write lightweight Web application UI test automation using the jQuery library. One of the technical reviewers of my article asked me about the pros and cons of using the jQuery approach compared with using the Selenium test framework and the Watir test framework. A second reviewer asked about the difference between using jQuery and using plain vanilla JavaScript. Additionally, a third reviewer pointed out that there is a new .NET based test framework named ASP.NET QA.
OK, let’s start with jQuery vs. plain JavaScript for Web app automation. The two approaches are very similar. Using the jQuery library has the advantages of a consistent selector and manipulator syntax to get references to controls, such as submit buttons, and syntax to set and examine control values. Additionally, jQuery is mostly browser agnostic so you don’t have to worry about whether code such as document.all["TextBox1"] will work with Firefox or not. One disadvantage of jQuery vs. plain JavaScript is that jQuery represents an external dependency to some extent. Now for jQuery test automation vs. using Selenium. Selenium is an excellent tool, but in my opinion a non-technical disadvantage of using Selenium is that time spent learning the Selenium framework does not help you directly with improving your developer skills. When using jQuery to write test automation you are learning skills which can be used not only for testing but also for Web development. One advantage of Selenium is that it is a big framework and has a lot of functionality at one higher level of abstraction than jQuery, so writing test automation with Selenium can be quicker than with jQuery (after you get over the initial Selenium learning curve). I am personally not a fan of Watir mostly because I just don’t like coding in Ruby nearly as much as I like coding with JavaScript. So for me jQuery has the advantage of using JavaScript which directly maps to improved development skills. An advantage of Watir compared to jQuery is that the Watir framework is quite well known so there is good documentation and support. Although I’m not positive, I believe that Watir works only with Internet Explorer, which if true, is a disadvantage compared to using jQuery. Now there is also Watin, which does not have the Ruby language disadvantage, but using C# or some other .NET compliant language does not directly map to improved Web development skills either. One of the reviewers of my jQuery article pointed out that there is a new "ASP.NET QA" framework available on CodePlex, Microsoft’s open source site. I haven’t had a chance to examine ASP.NET QA closely but it looks pretty nice.
This entry was posted in Software Test Automation. Bookmark the permalink.

One Response to Web App UI Test Automation with jQuery vs. Selenium and Watir

  1. Frank says:

    Hi James:Thank you for the blog entry. I found it useful to learn your opinions on jQuery, JavaScript, Watir and ASP.NET QA.Would it be possible to read your article draft? If so, please email it to fcohen@pushtotest.com.You may find it useful to know about PushToTest TestMaker. TestMaker is an open-source test automation framework. It repurposes test use cases expressed in Selenium, soapUI, TestGen4Web, Mozmill, Windmill, and unit tests written in Java, Python, Ruby, Groovy, PHP, Perl, and other dynamic languages into functional tests. load and performance tests, and business service monitors. TestMaker is a distributed test environment where the tests run in a QA lab of load generating services, in a Cloud Test environment, or both. It data-enables tests and includes a results analysis engine.TestMaker is extensible to support additional script runners. Adapting it to run jQuery-based tests is simple. We are already supporting Ajax testing through HtmlUnit as a headless browser alternative.Details are at http://www.pushtotest.com.I hope you will consider sending your article draft.Thanks.-Frank

Comments are closed.