Contents

Writing Javascript unit test cases

We are using JS Test Driver for Javascript unit testing. Here are steps to write your own test cases.

Test cases can be declared in .js files under your project. We're still working on best practices on where to put your tests but for now a simple approach is to create a folder co-located with your regular code under your project like this:

A .js file can declare as many test cases as you want but declaring one test case per file will be the best practice.

The test case declaration is as below. You will declare all the tests as functions. For more details refer to the JsTestDriver wiki here.

Running from Orion (under development)

We are planning to run js unit test by using JsTestDriver javascript library.
The target is to give Orion users capability to run their js unit test from browser , as part of the self-hosting functionality.Although not finalized yet, below is the initial UI prototype.