• Parameters

    • testClassName: string

      Name of the class of tests this test should be a part of.

    • testName: string

      Name of this specific test.

    • testFunction: ((arg) => void)

      Implementation of the test function.

        • (arg): void
        • Parameters

          Returns void

    Returns RegistrationBuilder

    Returns a RegistrationBuilder object where additional options for this test can be specified via builder methods.

    Remarks

    Registers a new GameTest function. This GameTest will become available in Minecraft via /gametest run [testClassName]:[testName].

    Example

    example1.js

           GameTest.register("ExampleTests", "alwaysFail", (test) => {
    test.fail("This test, runnable via '/gametest run ExampleTests:alwaysFail', will always fail");
    });

    Example

    simpleMobTest.ts

             gt.register("StarterTests", "simpleMobTest", (test: gt.Test) => {
    const attackerId = "fox";
    const victimId = "chicken";

    test.spawn(attackerId, new mc.BlockLocation(5, 2, 5));
    test.spawn(victimId, new mc.BlockLocation(2, 2, 2));

    test.assertEntityPresentInArea(victimId, true);

    test.succeedWhen(() => {
    test.assertEntityPresentInArea(victimId, false);
    });
    })
    .maxTicks(400)
    .structureName("gametests:mediumglass");