I have realized recently that I'm thinking about same question like other folks here:
I started to look around for current trends, and it seems people are really running QUnit tests with Selenium.
I already prototyped that solution at own and it's quite easy concept,
but the problems starts when comes to rapid test development with IDE.
The quick turnaround is crucial for JS unit test development as it is very important for development of Selenium tests (and it is also my favorite topic). :-)
So as I have realized, it could require lot of efforts to implement rapid development infrastructure (IDE integration) for such solution.
I have rather tried to find which are targets (WHY?):
- separating concerns (test domain) from server
- Selenium tests are too verbose for testing JS API
- and too slow for covering extensive number of test cases
- JS unit tests also doesn’t need server for providing initial DOM
- run JS unit tests = with mocked initial page (QUnit provides HTML)
- run JS integration tests = with initial DOM state provided by server
- running existing test suites
I was also thinking about goals and benefits (WHAT?):
- running tests (and debuging) from IDE
- to achieve quick turnaround
- reusing browser session in development
- no need to open new browser window for each individual test
- achieving fastest possible turnaround
- integration with Drone to prepare browsers in CI
- and thus sharing configuration with functional tests written in Selenium
- making QA happy!
- easy and familiar configuration
- imho this requirement excludes Java integration, sorry :-)
These points could be hard to achieve with Eclipse and QUnit/Selenium, but I realized that Eclipse and IntelliJ IDEA have nice integration with project which is similar to what I’m thinking about:
What if offers?
- grabs the browser session by pointing browser to specific URL
- available adapters for unit-test frameworks (including QUnit)
- simple YAML configuration of test suite- list of JS files to run
- Eclipse integration
- IDEA integration
- supports running specific test methods (that I like on JUnit)
- support for JS language seems more complete
What it doesn’t have, but what is doable?
- support of QUnit base files
- HTML file which loads qunit.js and some-test.js (the most of existing tests are in this structure)
- JSTD is loading JS file itself, so DOM needs to be constructed in the test code!
- still initial page structure could be loaded by hooking into JSTD lifecycle and loading DOM by AJAX
- running integration tests
- the same as in previous case, DOM can be loaded by AJAX
- debugging from IDE
- just need to use standard debugging developer tools (Firebug, …)
- browser driver
- integration with Drone could solve the problem
I’m ready to proceed and prototype integration, but first I would like to hear your opinions and where it suits your requirements and imaginations!