Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/gametest: Difference between revisions

From SAS Gaming Wiki
imported>MinecraftBedrockPlayer7
 
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{exclusive|bedrock}}
{{MC/Exclusive|bedrock}}
{{Infobox command
{{Infobox command
|name=gametest
|name=gametest
Line 9: Line 9:
== Usage ==
== Usage ==


A unit test (or GameTest) can be registered in an add-on using the GameTest framework, which is paired with a [[Minecraft:.mcstructure]] file. See {{slink|GameTest|Bedrock Edition}}.
A unit test (or GameTest) can be registered in an add-on using the GameTest framework, which is paired with a .mcstructure file. See {{slink|GameTest|Bedrock Edition}}.


Place a structure block and type the ID (in the format of <code>''<testClassName>'':''<testName>''</code>) in it, then execute <code>gametest runthis</code> (or <code>gametest runthese</code> for multiple structure blocks) to run the unit test in the [[Minecraft:world]]. Note that the "structure name" in structure block should be the ID of the unit test instead of structure's ID.
Place a structure block and type the ID (in the format of <code>''<testClassName>'':''<testName>''</code>) in it, then execute <code>gametest runthis</code> (or <code>gametest runthese</code> for multiple structure blocks) to run the unit test in the world. Note that the "structure name" in structure block should be the ID of the unit test instead of structure's ID.


<code>gametest run ..</code> can automatically place the test structure and run the test function from a unit test.
<code>gametest run ..</code> can automatically place the test structure and run the test function from a unit test.
Line 41: Line 41:


== Arguments ==
== Arguments ==
{{argument|be=1|testName: string|string}}
{{MC/Argument|be=1|testName: string|string}}
: Specified a string as gametest ID.
: Specified a string as gametest ID.
:{{arg desc|be=string}}
:{{MC/Arg desc|be=string}}


{{argument|be=1|repeatCount: int|int}}
{{MC/Argument|be=1|repeatCount: int|int}}
: Specifies the times the gametest repeats.
: Specifies the times the gametest repeats.
:{{arg desc|be=int}} And it must greater than 0.
:{{MC/Arg desc|be=int}} And it must greater than 0.


{{argument|be=1|stopOnFailure: Boolean|enum}}
{{MC/Argument|be=1|stopOnFailure: Boolean|enum}}
: Specifies whether to continue with the next repetition when current test fails.
: Specifies whether to continue with the next repetition when current test fails.
:{{arg desc|be=bool}}
:{{MC/Arg desc|be=bool}}


{{argument|be=1|rotationSteps: int|int}}
{{MC/Argument|be=1|rotationSteps: int|int}}
: Specifies the angle by which the gametest is rotate.
: Specifies the angle by which the gametest is rotate.
: 1 means 90° clockwise; 2 means 180°; 3 means 270° clockwise. Otherwise the gametest won't be rotated.
: 1 means 90° clockwise; 2 means 180°; 3 means 270° clockwise. Otherwise the gametest won't be rotated.
:{{arg desc|be=int}}
:{{MC/Arg desc|be=int}}


{{argument|be=1|tag: string|string}}
{{MC/Argument|be=1|tag: string|string}}
: Specifies GameTest class to run.
: Specifies GameTest class to run.
: Must be an existing Gametest class ID.
: Must be an existing Gametest class ID.


{{argument|be=1|width: int|int}}
{{MC/Argument|be=1|width: int|int}}
: Specifies x-axis width of the polished andesite platform and of the structure. Defaults to 5.
: Specifies x-axis width of the polished andesite platform and of the structure. Defaults to 5.
:{{arg desc|be=int}} And it should be less than or equal to 48.
:{{MC/Arg desc|be=int}} And it should be less than or equal to 48.


{{argument|be=1|height: int|int}}
{{MC/Argument|be=1|height: int|int}}
: Specifies y-axis height of the polished andesite platform and of the structure. Defaults to 5.
: Specifies y-axis height of the polished andesite platform and of the structure. Defaults to 5.
:{{arg desc|be=int}} And it should be less than or equal to 48.
:{{MC/Arg desc|be=int}} And it should be less than or equal to 48.


{{argument|be=1|depth: int|int}}
{{MC/Argument|be=1|depth: int|int}}
: Specifies z-axis width of the polished andesite platform and of the structure. Defaults to 5.
: Specifies z-axis width of the polished andesite platform and of the structure. Defaults to 5.
:{{arg desc|be=int}} And it should be less than or equal to 48.
:{{MC/Arg desc|be=int}} And it should be less than or equal to 48.


==History==
==History==
{{HistoryTable
{{HistoryTable
|{{HistoryLine|bedrock}}
|{{MC/HistoryLine|bedrock}}
|{{HistoryLine||1.16.210|dev=beta 1.16.210.60|Added {{cd|/gametest}}.}}
|{{HistoryLine||1.16.210|dev=beta 1.16.210.60|Added {{MC/Cd|/gametest}}.}}
|{{HistoryLine||1.16.220|dev=1.16.220.02|Added {{cd|stopOnFailure: Boolean}} and {{cd|repeatCount: int}} into {{cd|/gametest run ...}}.}}
|{{HistoryLine||1.16.220|dev=1.16.220.02|Added {{MC/Cd|stopOnFailure: Boolean}} and {{MC/Cd|repeatCount: int}} into {{MC/Cd|/gametest run ...}}.}}
|{{HistoryLine||1.17.0|dev=beta 1.16.230.50|Changed {{cd|/gametest runall}} to {{cd|/gametest runset}}.}}
|{{HistoryLine||1.17.0|dev=beta 1.16.230.50|Changed {{MC/Cd|/gametest runall}} to {{MC/Cd|/gametest runset}}.}}
|{{HistoryLine||1.18.30|dev=beta 1.18.20.27|Removed <code>radius: int</code> argument in <code>gametest clearall</code>.}}
|{{MC/HistoryLine||1.18.30|dev=beta 1.18.20.27|Removed <code>radius: int</code> argument in <code>gametest clearall</code>.}}
|{{HistoryLine||1.19.80|dev=Preview 1.19.80.22|Added <code>stopall</code> and <code>runsetuntilfail</code> subcommands.}}
|{{MC/HistoryLine||1.19.80|dev=Preview 1.19.80.22|Added <code>stopall</code> and <code>runsetuntilfail</code> subcommands.}}


}}
}}
Line 90: Line 90:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


[[Minecraft:de:Befehl/gametest]]
de:Befehl/gametest
[[Minecraft:lzh:令/gametest]]
lzh:令/gametest
[[Minecraft:pt:Comandos/gametest]]
pt:Comandos/gametest
[[Minecraft:ru:Команды консоли/gametest]]
ru:Команды консоли/gametest
[[Minecraft:zh:命令/gametest]]
zh:命令/gametest
[[Minecraft:ja:コマンド/gametest]]
ja:コマンド/gametest

Latest revision as of 20:10, 9 April 2026

Script error: No such module "Exclusive". Template:Infobox command Runs a unit test (also called a GameTest) from an Minecraft:add-on package containing Minecraft:GameTest script files.

Usage

A unit test (or GameTest) can be registered in an add-on using the GameTest framework, which is paired with a .mcstructure file. See Template:Slink.

Place a structure block and type the ID (in the format of <testClassName>:<testName>) in it, then execute gametest runthis (or gametest runthese for multiple structure blocks) to run the unit test in the world. Note that the "structure name" in structure block should be the ID of the unit test instead of structure's ID.

gametest run .. can automatically place the test structure and run the test function from a unit test.

gametest runset ... can automatically run all unit tests in the specified class at the same time.

gametest create .. can place a save mode structure block, a platform made of polished andesite, there-block-thick dirt base, and a command block with a stone button attached on it. It is useful for developers to create a new structure for the unit test.

Syntax

gametest runthis
Finds the nearest structure block within 15 blocks radius, and then tries to run GameTest with the ID specified in the structure block.
gametest run <testName: string> <stopOnFailure: Boolean> <repeatCount: int> [rotationSteps: int]
gametest run <testName: string> [rotationSteps: int]
Runs a specific GameTest.
gametest runthese
Finds all structure blocks within 200 blocks radius, and then tries to run GameTests with the IDs specified in the structure blocks.
gametest runset [tag: string] [rotationSteps: int]
Creates and runs all GameTests in this class (tag: GameTestTag).
gametest clearall
Clears all GameTests.
gametest create <testName: string> [width: int] [height: int] [depth: int]
Places structure block, command block, and polished andesite platform and dirt base.
gametest pos
Finds nearest structure block within 200 blocks radius.
gametest stopall
Manually stops all tests while they are running.
gametest runsetuntilfail [tag: string] [rotationSteps: int]
Creates and runs all GameTests in the class, but automatically stops if any of the tests fail.

Arguments

testName: string: string

Specified a string as gametest ID.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|string}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

repeatCount: int: int

Specifies the times the gametest repeats.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} And it must greater than 0.

stopOnFailure: Boolean: enum

Specifies whether to continue with the next repetition when current test fails.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|bool}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

rotationSteps: int: int

Specifies the angle by which the gametest is rotate.
1 means 90° clockwise; 2 means 180°; 3 means 270° clockwise. Otherwise the gametest won't be rotated.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

tag: string: string

Specifies GameTest class to run.
Must be an existing Gametest class ID.

width: int: int

Specifies x-axis width of the polished andesite platform and of the structure. Defaults to 5.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} And it should be less than or equal to 48.

height: int: int

Specifies y-axis height of the polished andesite platform and of the structure. Defaults to 5.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} And it should be less than or equal to 48.

depth: int: int

Specifies z-axis width of the polished andesite platform and of the structure. Defaults to 5.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} And it should be less than or equal to 48.

History

Template:HistoryTable

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/gametest lzh:令/gametest pt:Comandos/gametest ru:Команды консоли/gametest zh:命令/gametest ja:コマンド/gametest