A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mediawiki.org/wiki/Extension:MWUnit below:

Extension:MWUnit - MediaWiki

This extension is incompatible with MediaWiki 1.42 or any later release!

You are advised against using this extension on a live site.


MediaWiki developers are invited to pledge their efforts to updating this extension to make it compatible with MediaWiki 1.44 by replacing the {{Incompatible }} template with {{Incompatible |version=1.42|pledge=~~~~}}.

This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored.

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:

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.

Below is a basic example of a full test suite (Test:Foobar). This example uses the Variables extension to show how fixtures and global state work.

<!-- Define a fixture -->
<setup>
    <!-- Define some variables -->
    {{#vardefine: bar | boofar }}
    {{#vardefine: baz | {{Example}} }}
</setup>

<!-- Define a test case -->
<testcase name="testFoobar" group="Foobar tests" context="canonical">
    <!-- Assert that the variable "bar" is equal to the string "boofar" -->
    {{#assert_equals: {{#var: bar }} | boofar }}

    <!-- Assert the variable "baz" is numeric -->
    {{#assert_is_numeric: {{#var: baz }} }}
</testcase>

<testcase name="testRisky" group="Foobar tests" context="user">
    <!-- This test would be marked as "Risky", because it contains no assertions -->
</testcase>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4