Extension:MWUnit/Organizing tests

MWUnit supports several ways to group and organize tests. This page explains how to appropriately organize tests.

An important property of MWUnit is that tests are reasonably composable. You are able to run any number of tangential tests together. For instance, all tests in a group, or all tests on a test page, or an individual test.

Composing a group
Any test must belong to one group, and one group only. A test can be added to a specific group using the  annotation, as shown in this example:

 ...

Tests in the same group can be run together, but are not necessarily in the same fixture. This means that tests in the same group may not necessarily share the same global state and parser. Only tests that are on the same page will share the same fixture.

Tests in the same group can be run together via the special page.

Organizing tests on a test page
A test page is any page in the  namespace. It can contain one or many tests. Each test on a test page shares the same parser and global state. A single test page should preferably test one, and only one, template (or some other "unit" of wikitext).

Tests on the same test page can be run in a group only via the test page itself. It can be done by pressing the "Run unit tests" button in the side menu.