Test instance definition

A test instance represents a test that can be run by the GameTest framework.

Definition

Test instances can be defined in data packs, as part of the directory structure below.

JSON Format

Test instances are defined using the following format:

  • [NBT Compound / JSON Object] The root object.
    • [NBT Compound / JSON Object][String] environment One test environment (an [String] ID, or a new [NBT Compound / JSON Object] test environment definition) — The environment of this test.
    • [String] structure Resource location of the structure to use for the test.
    • [Int] max_ticks A positive integer representing the maximum number of ticks allowed to pass before the test is considered timed out.
    • [Int] setup_ticks: Represents a number of ticks to wait after placing the structure before starting the test. Must be a non-negative integer. Default to 0.
    • [Boolean] required: Whether the test is considered required to pass for the full test suite to pass. Defaults to true.
    • [String] rotation Optional rotation to apply to the test structure. Must be one of none (default), clockwise_90, 180 and counterclockwise_90.
    • [Boolean] manual_only Set to true for tests that are not included as part of automated test runs. Defaults to false.
    • [Boolean] sky_access Whether the test needs clear access to the sky. Tests are enclosed in barrier blocks. If set to true, the top is left open. Defaults to false.
    • [Int] max_attempts: Number of attempts to run the test. Default to 1.
    • [Int] required_successes Number of attempts that must succeed for the test to be considered successful. Defaults to 1.
    • [String] type: The type of test. Must be one of block_based and function. See GameTest#Test instance for more information.

History

Java Edition
1.21.525w03aAdded test instance definition to data packs.
25w04aRenamed field batch to environment, and sky_accesss to sky_access

Navigation