Manual:Parser tests/zh

Each parser test case specifies input wikitext and output HTML, to confirm that things operate as expected. The actual output is compared with the desired result, and thus, the parser test cases (also known as parser tests) can be helpful at spotting regressions.

The parser test cases reside in. Extensions should place their tests in a  directory.

They can be run both through the phpunit test suite and through the standalone parserTests.php -- so a parser test failure should trigger a Jenkins test failure.

Syntax & execution

 * Version 2 format
 * Starting with 1.35, parser tests are required to be in the Version 2 format. Specifying version 2 indicates that the tests are ready to be run in "tidy" mode (See T249138).
 * To indicate your parser tests are run in version 2 format, the first line in your parser test file must be
 * To indicate your parser tests are run in version 2 format, the first line in your parser test file must be

Syntax is as follows:

The config section can be omitted. If you specify configuration settings there, make sure you don't have any whitespace between your expressions, as whitespace isn't trimmed by the test runner.

In order to create a new article the syntax is:

In order to be sure that the extension tag tag1 is loaded add at the beginning of the file:

Extensions that place their tests in  and are using extension.json will automatically have their parser tests run. For extensions using the legacy extension loading system, they can use:

To run the parser tests, go to the root directory of your local MediaWiki installation and execute the following from the command line:

To run tests for just one file, use  param. See more params with.

参见

 * QA and testing