Extension:MWUnit/Risky and skipped tests
MWUnit performs additional checks when it performs tests. These checks ensure the validity of the tests and inform the user about possibly invalid tests or misconfigurations.
Risky tests
editInvalid @covers
annotation
edit
MWUnit can be configured, through the $wgMWUnitStrictCoverage
configuration parameter, to be strict about invalid/untruthful @covers
annotations. When enabled, a test will be marked as risky if the template a test @covers
is not used directly, or indirectly, in a test case.
Useless tests
editBy default, MWUnit is strict about tests that do not perform any assertions. A test that does not perform any assertions will be marked as risky.
Invalid assertions
editMWUnit is always strict about tests with invalid assertions. An assertion is invalid when it contains too few parameters or parameters of an incorrect type. A test that has one or more invalid assertions will be marked as risky.
A test will not be marked as invalid when an assertion has too many parameters.
Mocked covers template
editA test will be marked as risky when the template that test should cover is mocked.
Skipped tests
editTests marked as skipped are never run, because they are either broken or marked with @skip
.
Invalid context
editMWUnit is always strict about tests using an invalid context annotation. The context annotation must either be empty, "canonical" or "user". A test that has an invalid context annotation will be skipped.
Invalid user
editMWUnit requires the user specified in @user
to be an existing user. If the user specified does not exist, the test will be skipped.
Missing permissions for user mock
editA test will be skipped when it is required to be run as another user, but running tests as another user is disabled or disallowed.
Missing required extensions
editA test will be skipped if one or more extensions specified through @requires
is missing.
See also
edit- Extension:MWUnit/Writing tests - Documentation on writing tests
- Extension:MWUnit/Running tests - Documentation on running tests
- Extension:MWUnit/Organizing tests - Documentation on how to organize tests
- Extension:MWUnit/Assertions - List of available assertions
- Extension:MWUnit/Annotations - List of available test annotations
- Manual:Unit testing - Manual page about unit testing