Test File Directory Hierarchy


With in the TestCases directory individual tests are organized into subdirectories corresponding to chapters (top level section numbers) of the ECMAScript 5 Specification.
For Example:
TestCases
      chapter11
      chapter12
      chapter13

Test File Naming Conventions


Individual test files have the following format:

sectionNumber[@nnn][-algorithmStepNumber]-testNumber[-s].js

Where:
sectionNumber: is the section number of the ECMAScript 5 Specification that this test is primarily concerned with.
@n: is optional and used if a section contains more than one algorithm. n is ordinal number of the algorithm within the section.
algorithmStepNumber: is the step number within the algorithm that the rest relates to. It is excluded for tests that relate to non-algorithmic sections of the specification.
testNumber: is present if there is more than one testcase for a particular algorithm step or non-algorithm specification section.
-s: is an optional suffix -s that identifies the that the test is only applies to strict mode

Test File Structure


Each testcase must be a single .js file.
A testcase is made up of the following parts (1) testName (2) testcase (3) prereq and looks like:
/// Copyright (c) Microsoft Corporation. 
/// 
/// The contents of this file are subject to the terms of the New BSD License. 
/// You may obtain a copy of the License at http://es5conformm.codeplex.com/license 
/// 
/// Alternatively the contents of this file may be used under the terms of the Microsoft Public License. 
/// You may obtain a copy of the License at http://www.microsoft.com/opensource/licenses.mspx#Ms-PL 
 
var testName = '';
function testcase() {}
 
sth_addTest(testName, testcase);

The testName is just string value describing the testcase
The testcase is a function. Implement it such that it returns the boolean value true if it is meant to pass.
The prereq is an optional prerequisite that you can specify; implement it such that it returns the boolean
value true if it is meant to pass. The testcase will be run only if this prereqisite passes.

Once you implement the testcase, add it into the harness by calling sth_addTest(testName, testcase, prereq);
Drop this js file into any folder under TestCases (create a folder if you want to).
Note that you can use names other than testName and testcase, and that prereq is optional.