Extension:MWUnit/API
MWUnit adds two API modules, one API query module, and one regular API module. These modules can be used to query or run unit tests via the MediaWiki Action API.
action = rununittests
editRun unit tests. Any combination of parameters is possible, and all tests specified by the parameters will be run. This API modules requires the mwunit-runtests
user right.
parameters
editgroup
- The name of a group of tests.
test
- The canonical name of a test.
page
- The name of a test page (with the namespace prefix).
covers
- The name of a template covered by one or more tests.
Example
editRun all unit tests in the group `foobar`
Result |
---|
{
"Qux::foobb":{
"result":{
"code":1,
"message":"This test is marked as risky, because it contains 0 assertions."
},
"metadata":{
"name":"foobb",
"group":"foobar",
"title":"Test:Qux",
"assertions":0,
"covers":""
}
},
"Boofar::foo":{
"result":{
"code":2,
"message":""
},
"metadata":{
"name":"foo",
"group":"foobar",
"title":"Test:Boofar",
"assertions":1,
"covers":"banana"
},
"output":[
"string(4) \"asdf\""
]
},
"Boofar::foobb":{
"result":{
"code":1,
"message":"This test is marked as risky, because it contains 0 assertions."
},
"metadata":{
"name":"foobb",
"group":"foobar",
"title":"Test:Boofar",
"assertions":0,
"covers":""
}
},
"Foobar::foo":{
"result":{
"code":2,
"message":""
},
"metadata":{
"name":"foo",
"group":"foobar",
"title":"Test:Foobar",
"assertions":1,
"covers":"banana"
},
"output":[
"int(12343)"
]
},
"Foobar::foobb":{
"result":{
"code":1,
"message":"This test is marked as risky, because it contains 0 assertions."
},
"metadata":{
"name":"foobb",
"group":"foobar",
"title":"Test:Foobar",
"assertions":0,
"covers":""
}
}
}
|
list = unittests
editList all unit tests that match certain criteria. This module requires the read
user right.
parameters
editgroup
- The name of a group of tests.
page
- The name of a test page (with the namespace prefix).
covers
- The name of a template covered by one or more tests.
Example
editList all unit tests in the group `foobar`
Result |
---|
{
"batchcomplete": "",
"Kaaskroket::foobb": {
"name": "foobb",
"group": "foobar",
"article_id": 2,
"article_text": "Test:Kaaskroket"
},
"Fksdl::foo": {
"name": "foo",
"group": "foobar",
"article_id": 7,
"article_text": "Test:Fksdl"
},
"Fksdl::foobb": {
"name": "foobb",
"group": "foobar",
"article_id": 7,
"article_text": "Test:Fksdl"
},
"FKl::foo": {
"name": "foo",
"group": "foobar",
"article_id": 8,
"article_text": "Test:FKl"
},
"FKl::foobb": {
"name": "foobb",
"group": "foobar",
"article_id": 8,
"article_text": "Test:FKl"
}
}
|