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

From SAS Gaming Wiki
Revision as of 20:10, 9 April 2026 by SyncBot (talk | contribs) (Fix template calls: add MC/ prefix)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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