Minecraft:Commands/gametest
More actions
Template: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 Minecraft:.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 Minecraft: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).
- Creates and runs all GameTests in this class (
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
- Specified a string as gametest ID.
- Template:Arg desc
- Specifies the times the gametest repeats.
- Template:Arg desc And it must greater than 0.
- Specifies whether to continue with the next repetition when current test fails.
- Template:Arg desc
- 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.
- Template:Arg desc
- Specifies GameTest class to run.
- Must be an existing Gametest class ID.
- Specifies x-axis width of the polished andesite platform and of the structure. Defaults to 5.
- Template:Arg desc And it should be less than or equal to 48.
- Specifies y-axis height of the polished andesite platform and of the structure. Defaults to 5.
- Template:Arg desc And it should be less than or equal to 48.
- Specifies z-axis width of the polished andesite platform and of the structure. Defaults to 5.
- Template:Arg desc And it should be less than or equal to 48.
History
External links
Minecraft:de:Befehl/gametest Minecraft:lzh:令/gametest Minecraft:pt:Comandos/gametest Minecraft:ru:Команды консоли/gametest Minecraft:zh:命令/gametest Minecraft:ja:コマンド/gametest