Semantic MediaWiki and related extensions
|
Extensions that want to create their own JSONScript
integration tests and have them run against MediaWiki and Semantic MediaWiki can take advantage of the existing SMW test infrastructure for integration tests (script interpreter, assertions validators etc.) by:
bootstrap.php
JSONScriptServicesTestCaseRunner
To ensure that relevant classes are registered and available during the test run add the following lines to the PHPUnit bootstrap.php
.
Semantic MediaWiki provides two script runners that can be used by extensions:
JSONScriptServicesTestCaseRunner
allows to use the parser
, parser-html
, special
, and semantic-data
type assertionsJSONScriptTestCaseRunner
is the base runner that provides all methods necessary to run test cases, it also includes version checks as well as to validate custom defined dependenciesThe JSONScriptServicesTestCaseRunner
was introduced to help users to quickly create a custom script runner (e.g. CustomJsonScriptTest
) that iterates over the selected test location without much modification to the test itself besides adding the location of the test case folder.
The bootstrap.json contains an example that can be used as starting point for a test scenario. The https://github.com/SemanticMediaWiki/SemanticMediaWiki/tree/master/tests/phpunit/Integration/JSONScript/docs/design.md "design" document holds detail options and usage of assertions methods.
In some cases the selected JSON
style may vary or contains information that require additional validation therefore the script runner can easily be extended with something like:
Describe methods and classes require SMW 3.1+.