mojang-gametest Module

Important

These APIs are experimental as part of GameTest Framework. As with all experiments, you may see changes in functionality in updated Minecraft versions. Check the Minecraft Changelog for details on any changes to GameTest Framework APIs. Where possible, this documentation reflects the latest updates to APIs in Minecraft beta versions.

Enumerations

Classes

Functions

register

register(testClassName:string, testName:string, testFunction:(arg: Test) => undefined): RegistrationBuilder

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

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: Test) => undefined

    Implementation of the test function.

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

Examples

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