Testing with testharness.js

Javascript tests

No manual interaction or rendering

Sync tests

Simple Synchronous Test

Run test

localStorage Example

From the spec:

The getItem(key) method must return the current value associated with the given key. If the given key does not exist in the list associated with the object then this method must return null.

localStorage getItem Test

Run test

Async tests

Structure of async tests

Simple Asynchronous Test

Run test

Storage Event Example

From the spec:

When the setItem(), removeItem(), and clear() methods are called on a Storage object x that is associated with a local storage area, if the methods did something, then in every Document object whose Window object's localStorage attribute's Storage object is associated with the same storage area, other than x, a storage event must be fired, as described below.

Storage Event Test 1

Run test

Storage Event Test 2

Run test

Other Features


Rich set of asserts:

Control over test discovery and timings

It is possible to:

Notification API

You can find out: