Kai Hackemesser - 2013-01-11

Jasmine JUnit Runner

A MetService innovation product

The Jasmine JUnit runner allows to organise your Jasmine test suites in JUnit annotated java classes to run them within Eclipse or maven-surefire or any other IDE supporting maven project configuration.

[History and Background]
[Usage]

Sequence of a Test run

  1. The test runner starts a local jetty server instance to return all resources to the browser
  2. The test runner starts all required browser as Selenium webdrivers
  3. For each test and each spec a http session is generated that stores information about the environment for this spec.
  4. For each spec the browser(s) is(are) commanded to load a page using a given session, which loads an unique test page for each spec.
  5. For each test page the test runner retrieves the Jasmine test results via Selenium commands and prepares JUnit output.
  6. After all tests are run, the JUnit suite tree is produced and returned with results.

Eclipse JUnit output

Debugging

The Jasmine test runner can be configured to pause on a failed spec. The presence of this environment property allows this:

-DjasminePauseOnFailure

On failure the runner will wait until you press the continue button placed on the test page
While waiting you can take the browsers current URL to test in a browser with debugging capabilities again and again.

Running with remote browsers

To run tests on a headless system (Jenkins slave) one needs a server with working display driver to run browsers there.
That server needs a Selenium Remote Control (RC) server running and listening
To run a test against a remote system, following setting is required:

-DremoteBrowserServer={hostname of Selenium RC}

The remote system needs access to the system that runs the test (hostname is DNS resolvable)

Do not enable debugging and remote at the same time!

Last but not least

Eclipse JUnit view is limited:

  • It can't forward you to the test method if it is defined as a Suite.
  • It doesn't support generating the suite during test run, it must know in advance what to display
  • JUnit doesn't store execution time on the description, that information gets lost in process.
 

Related

Wiki: History and Background
Wiki: Usage


Last edit: Kai Hackemesser 2013-02-16