Difference between revisions of "Category talk:Template test case/doc"
blackwiki>Mr. Stradivarius (add basics of Lua usage) |
blackwiki>Mr. Stradivarius (remove the Lua interface docs, as this module shouldn't generally be called from Lua) |
||
| Line 2: | Line 2: | ||
== Usage == | == Usage == | ||
| − | |||
This module should not usually be called directly. Instead, you should use one of the following templates: | This module should not usually be called directly. Instead, you should use one of the following templates: | ||
| Line 18: | Line 17: | ||
It is also possible to use a format of <code><nowiki>{{#invoke:template test case|main|</nowiki>''parameters''<nowiki>}}</nowiki></code>. This uses the same defaults as [[Template:Test case]]; please see that page for documentation of the parameters. | It is also possible to use a format of <code><nowiki>{{#invoke:template test case|main|</nowiki>''parameters''<nowiki>}}</nowiki></code>. This uses the same defaults as [[Template:Test case]]; please see that page for documentation of the parameters. | ||
| − | + | There is no direct interface to this module for other Lua modules. Lua modules should generally use Lua-based test case modules such as [[Module:UnitTest]] or [[Module:ScribuntoUnit]]. If it is really necessary to use this module, you can use [[mw:Extension:Scribunto/Lua reference manual#frame:expandTemplate|frame:expandTemplate]] with one of the templates listed above. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| | <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| | ||
Revision as of 02:24, 1 December 2014
This module provides a framework for making templates which produce a template test case. While test cases can be made manually, using Lua-based templates such as the ones provided by this module has the advantage that the template arguments only need to be input once, thus reducing the effort involved in making test cases and reducing the possibility of errors in the input.
Usage
This module should not usually be called directly. Instead, you should use one of the following templates:
Parameter-based templates:
- Template:Test case - for standard test cases
- Template:Testcase table - for test cases arranged side by side in columns
- Template:Testcase rows - for test cases arranged as rows in a table
- Template:Collapsible test case - for test cases that are collapsed by default if the results are the same.
The only difference between these templates is their default arguments. For example, it is possible to display test cases side by side in Template:Testcase rows by specifying |_format=columns
Nowiki-based templates:
- Template:Test case nowiki - for test cases created from template code wrapped in nowiki tags (useful for displaying templates with many parameters)
It is also possible to use a format of {{#invoke:template test case|main|parameters}}. This uses the same defaults as Template:Test case; please see that page for documentation of the parameters.
There is no direct interface to this module for other Lua modules. Lua modules should generally use Lua-based test case modules such as Module:UnitTest or Module:ScribuntoUnit. If it is really necessary to use this module, you can use frame:expandTemplate with one of the templates listed above.