User:Xxmarijnw/Extension:MWUnit/Annotations

An annotation is a special form of metadata that can be added to the source code of some programming languages. In the case of MWUnit, annotations are added through tag attributes. This appendix shows all the annotations supported by MWUnit.

@name
The  annotation is a required annotation. It is used to give an identifying name to a test case. The name for each test case on a page should be unique, but this is not enforced. MWUnit does throw an exception when a name is reused, but it will still run the test without any issue.

...  ...

@group
A test must be tagged as belong to one, and only one, group. This is done through the  annotation.

...  ...

Tests can be selected for executed based on group via the special page.

@context
The  annotation can be used to run the test in a specific context. By default, tests are ran in a canonical context. This means the parser is initialized with an anonymous user and the content language. This is done to make the output of the test consistent across users and languages.

You can choose to run a specific test in user context using the  annotation. A test run in user context will initialize the parser with the current logged in user and the language that user has set. This can be useful for testing templates that depend on if the user is logged in or who is logged in or which language is selected.

The  annotation can either be left empty, have the value   or have the value.

...  ...

 ... ...