This framework is in the alpha stage. There are a lot of missing features compared to the 1.17+ Game Tests.
Add this mod to dependencies:
dependencies {
implementation("com.bqc0n:mctest:0.0.2")
}and write some tests:
@GameTestHolder("mctest")
public class Tests {
@GameTest
public void placeDirt(GameTestHelper helper) {
BlockPos pos = BlockPos.ORIGIN.up();
helper.setBlock(pos, Blocks.DIRT);
helper.succeedWhenBlockPresent(Blocks.DIRT.getDefaultState(), pos);
}
}Note that the GameTestHolder annotation is required.
then run the tests using the mctest runall command:
Test name will be <namespace>:<class name>.<method name> in lowercase, so in the example above it will be mctest:tests.placedirt.
Structure name is a bit more complicated, it will be
<namespace>:<class name>_<method name>if notemplatespecified in@GameTestannotation.<namespace>:<class name>_<template>iftemplateis specified in@GameTestannotation, but no:in it.<template>iftemplateis specified in@GameTestannotation and it contains:.
All above is in lowercase. So in the example above it will be mctest:tests_placedirt.
Underscores are used instead of dots because we can't use dots in 1.12.2 structure names.
