Extension:MWUnit

The MWUnit extension provides a unit testing framework for templates, parser functions and other wikitext.

It allows people that write technical templates to programmatically test those templates and changes to those templates. It ensures that a template, or section of a template, meets its design requirements and behaves exactly as intended.

MWUnit is an instance of the xUnit unit testing framework architecture.

The extension defines a number of assertions. These assertions are in the form of parser functions and test whether the given value conforms to the assertion. The most import assertions are:


 * - tests whether the given strings are equal
 * - tests whether the given string is empty
 * - tests whether the given string is true (a string is considered true, if and only if it is "true", "yes", "on" or "1")

The complete list of available assertions can be found here.

Click through the pages in the navigation bar at the top of this page to learn about MWUnit.

Example
Below is a basic example of a full test suite. This example uses the Variables extension to show how fixtures and global state work.