<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://aidalinux.ru/wiki/index.php?action=history&amp;feed=atom&amp;title=%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0%3ATemplate_sandbox_and_test_cases</id>
	<title>Справка:Template sandbox and test cases - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://aidalinux.ru/wiki/index.php?action=history&amp;feed=atom&amp;title=%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0%3ATemplate_sandbox_and_test_cases"/>
	<link rel="alternate" type="text/html" href="https://aidalinux.ru/wiki/index.php?title=%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0:Template_sandbox_and_test_cases&amp;action=history"/>
	<updated>2026-04-21T03:48:46Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://aidalinux.ru/wiki/index.php?title=%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0:Template_sandbox_and_test_cases&amp;diff=369&amp;oldid=prev</id>
		<title>Langator: Новая страница: «Templates are a very powerful feature of MediaWiki, but mistakes can be easily made, even by experienced users. Complex templates should therefore...»</title>
		<link rel="alternate" type="text/html" href="https://aidalinux.ru/wiki/index.php?title=%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0:Template_sandbox_and_test_cases&amp;diff=369&amp;oldid=prev"/>
		<updated>2011-12-24T15:15:20Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «&lt;a href=&quot;/w/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B0:Templates&quot; title=&quot;Справка:Templates&quot;&gt;Templates&lt;/a&gt; are a very powerful feature of MediaWiki, but mistakes can be easily made, even by experienced users. Complex templates should therefore...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Help:Templates|Templates]] are a very powerful feature of MediaWiki, but mistakes can be easily made, even by experienced users. Complex templates should therefore be accompanied by '''[[wikipedia:Sandbox (software development)|sandboxes]]''' and '''[[wikipedia:test case|test cases]]''' to prevent bugs.&lt;br /&gt;
&lt;br /&gt;
== For what kind of templates ==&lt;br /&gt;
It is recommended to apply the test case pattern to templates using [[mw:Help:Extension:ParserFunctions|ParserFunctions]] that can generate very different looking output, such as the ones that take many parameters, or the ones that have many branches of the &amp;lt;tt&amp;gt;#switch&amp;lt;/tt&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
For navigational boxes, of which the outputs are almost identical on each transcluding page, the benefit may not outweight the time and effort.&lt;br /&gt;
&lt;br /&gt;
Any template that is transcluded in thousands of pages should of course be tested before an edit is made.&lt;br /&gt;
&lt;br /&gt;
== Prerequisite ==&lt;br /&gt;
The template must be properly documented following [[wikipedia:Wikipedia:Template documentation|Wikipedia:Template documentation]].&lt;br /&gt;
&lt;br /&gt;
Furthermore, the template should not have too many interleaving &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;noinclude&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; blocks. Ideally there is only one &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;noinclude&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; block, placed at the bottom of the template, and containing the [[Template:Documentation|&amp;lt;nowiki&amp;gt;{{Documentation}}&amp;lt;/nowiki&amp;gt;]] template.&lt;br /&gt;
&lt;br /&gt;
== How to create /sandbox and /testcases subpages ==&lt;br /&gt;
1: Suppose your template is named &amp;lt;tt&amp;gt;Template:X&amp;lt;/tt&amp;gt;. Create sandbox and testcases subpages by clicking on the &amp;quot;create&amp;quot; links in the Note box under the documentation. The subpages will have the names &amp;lt;tt&amp;gt;Template:X/sandbox&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Template:X/testcases&amp;lt;/tt&amp;gt; and are preloaded with some default contents. When these subpages are present, the Note box automatically provide links to them. Note that &amp;quot;/sandbox&amp;quot; and &amp;quot;/testcases&amp;quot; are spelled in all lower-case.&lt;br /&gt;
&lt;br /&gt;
2: Copy only the code (everything that is not surrounded by &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;noinclude&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;) from your &amp;lt;tt&amp;gt;Template:X&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;Template:X/sandbox&amp;lt;/tt&amp;gt;. Keep the [[Template:Template sandbox notice|&amp;lt;nowiki&amp;gt;{{Template sandbox notice}}&amp;lt;/nowiki&amp;gt;]] line at the bottom:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code style=&amp;quot;display:table; line-height:1.2em;&amp;quot;&amp;gt;&amp;amp;lt;noinclude&amp;gt;&amp;lt;br&amp;gt;&amp;lt;nowiki&amp;gt;{{Template sandbox notice}}&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;&amp;amp;lt;/noinclude&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In other words, the result should be:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code style=&amp;quot;display:table; line-height:1.2em;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;background-color: #FFFF66&amp;quot;&amp;gt;[-- Template code --]&amp;lt;/span&amp;gt;&amp;amp;lt;noinclude&amp;gt;&amp;lt;br&amp;gt;&amp;lt;nowiki&amp;gt;{{Template sandbox notice}}&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;&amp;amp;lt;/noinclude&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|The template code must start directly before and touch the &amp;lt;code&amp;gt;&amp;amp;lt;/noinclude&amp;gt;&amp;lt;/code&amp;gt; tag. Any blank space or newlines between the template code and the &amp;lt;code&amp;gt;&amp;amp;lt;/noinclude&amp;gt;&amp;lt;/code&amp;gt; tag can cause the template to render unwanted spaces or newlines when used.}}&lt;br /&gt;
&lt;br /&gt;
3: Copy a few transcluding examples from articles (&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;{{X | .... }}&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;) to your &amp;lt;tt&amp;gt;Template:X/testcases&amp;lt;/tt&amp;gt;. In the test case subpage, duplicate each example, and for '''one copy''' of each example, replace &amp;lt;tt&amp;gt;X&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;X/sandbox&amp;lt;/tt&amp;gt;. This is done so that you may compare the old and new outputs side by side in the future. Lastly, add the following line at the beginning of the test case page. It does not matter how many blank lines you put around it:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code style=&amp;quot;display:table; line-height:1.2em;&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;{{Template testcases notice}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4: Thus &amp;lt;tt&amp;gt;Template:X/testcases&amp;lt;/tt&amp;gt; will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 {{Template testcases notice}}&lt;br /&gt;
&lt;br /&gt;
 {{X | foo}}&lt;br /&gt;
 {{X/sandbox | foo}}&lt;br /&gt;
&lt;br /&gt;
 {{X | bar}}&lt;br /&gt;
 {{X/sandbox | bar}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How to use them subsequently ==&lt;br /&gt;
* Sync sandbox from the real template (i.e. step 2 above)&lt;br /&gt;
* Have fun editing the sandbox&lt;br /&gt;
* Verify the test cases&lt;br /&gt;
* If everything looks good, copy the code from the sandbox to the real template&lt;br /&gt;
&lt;br /&gt;
If you chose not to compare the new and old outputs side by side described at the last bullet point of the previous section, it is recommended to use a tabbed browser and open the test case subpage before changing the sandbox, and another after changing the sandbox. This can ensure that the differences are compared accurately.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
* [[Template:GenericCmd|&amp;lt;nowiki&amp;gt;{{GenericCmd}}&amp;lt;/nowiki&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Template:Template sandbox notice|&amp;lt;nowiki&amp;gt;{{Template sandbox notice}}&amp;lt;/nowiki&amp;gt;]] – To put at the bottom of /sandbox pages.&lt;br /&gt;
* [[Template:Template testcases notice|&amp;lt;nowiki&amp;gt;{{Template test cases notice}}&amp;lt;/nowiki&amp;gt;]] – To put on top of /testcases pages.&lt;br /&gt;
&lt;br /&gt;
[[Category:Help]]&lt;/div&gt;</summary>
		<author><name>Langator</name></author>
	</entry>
</feed>