When comparing Selenium vs QUnit, the Slant community recommends Selenium for most people. In the question“What are the best automated browser testing frameworks?” Selenium is ranked 1st while QUnit is ranked 5th. The most important reason people chose Selenium is:
The WebDriver protocol is standardized by the World Wide Web Consortium which makes it easy for third-parties to get involved and contribute to Selenium. WebDriver has been the foundation of many additional automation projects besides core selenium and has become the de-facto standard for UI automation.
Ranked in these QuestionsQuestion Ranking
Pro Uses an approved WC3 standard - WebDriver
The WebDriver protocol is standardized by the World Wide Web Consortium which makes it easy for third-parties to get involved and contribute to Selenium.
WebDriver has been the foundation of many additional automation projects besides core selenium and has become the de-facto standard for UI automation.
Pro Integrates with any CI tool
Selenium, with its ability to interact with different testing frameworks, like NUnit or xUnit, makes it easy to get Selenium working with practically any Continuous Integration services.
Pro Actively supported
The open source community behind Selenium has a very large & engaged developer base. This ensures a stable support channel for the tool. In addition, various companies also provide support for Selenium. This active and multi-channel support provides a much more lucrative option for developers looking to implement Selenium in their workflow.
Pro Support for many languages
Selenium is based on Java and can be run on Windows, Mac, Linux, Unix, etc.
Supports many browsers and a solid platform for adding future browsers to selenium (WebDriver)
Pro Integrates well with existing testing frameworks
Pro You can use the same IDE you use for coding to debug
Pro Ability to imitate a real user using the application
Testing is analogous to a human being using the web application which is not possible with a solution which runs headless and claims to run faster than Selenium.
Pro Use the very minimum amount of code required to run
Selenium tries to inject into the page only the bare minimum of code needed to run the tests.
Pro Easy to set preconditions for the tests
Pro Tests run in the order they're added to the suite
In cases where you want (I know your test cases must be atomic) where you really really want your test cases to run in a specific order, maybe if the current one rely on those of previous case, you can use Qunit by setting QUnit.config.reorder = false and your test cases will run in the order you've provided.
Pro Works really well if performing DOM Testing
All frontend developers already know the ease that jQuery framework has brought to their lives, in handling DOM events and accessing elements. Since Qunit was built as a part of jquery (is even used by jQuery itself for unit testing) hence it makes testing of DOM elements a lot easier.
Pro Extremely easy to start from scratch
Seriously! All you have to do is include the Qunit library from the CDN, then create your Testcases js file, and RUN IT! . Your outputs would be displayed in a pretty little format in your browser.
Con The IDE for recording isn't too powerful
Con Issues with locators
Locators that support common attributes like:
Con Testing of Async operations can be a little tough at times.
Qunit, expects us to call the start() function before the Async function itself, and stop() after it stops. This can be a problem when you have no way of knowing, when your function will start or stop (your testing a number of dependent functions)