Skip to main content
HRTK provides 24 annotations across the com.frotty27.hrtk.api.annotation package. This page is a quick-reference table with brief descriptions and links to the relevant documentation.

Test Markers

These annotations mark methods as tests or benchmarks. At least one must be present for HRTK to discover the method.
AnnotationTargetDescriptionDocs
@HytaleTestMethodPrimary test marker. Optional display name parameter.Your First Test
@EcsTestMethodECS-level test. Injects EcsTestContext, adds "ecs" tag.ECS Testing
@WorldTestMethodWorld-level test. Injects WorldTestContext, adds "integration" tag.World Testing
@CombatTestMethodCombat test. Provides WorldTestContext for combat scenarios.Stats & Combat
@StatsTestMethodStats-focused test. Marker for stat-related testing.Stats & Combat
@InventoryTestMethodInventory test. Marker for inventory-related testing.Inventory & Loot
@SpawnTestMethodSpawn test. Marker for entity spawning scenarios.World Testing
@FlowTestMethodMulti-step flow test. world and timeoutTicks parameters.Flow Tests
@AsyncTestMethodAsync test with timeoutTicks for tick-based timeout.Async & Tick Waiting
@BenchmarkMethodPerformance benchmark. warmup, iterations, batchSize.Benchmarks
@RepeatedTestMethodRun N times. Each repetition reported separately.Timeouts & Repetition
@ParameterizedTestMethodRun with multiple values from @ValueSource.Parameterized Tests

Configuration

These annotations configure how tests behave.
AnnotationTargetDescriptionDocs
@HytaleSuiteClassSuite marker. value (name), isolation (strategy).Test Suites
@TagClass/MethodString tag(s) for filtering. Multiple values supported.Filtering & Tags
@OrderMethodExecution order within suite. Lower values run first.Filtering & Tags
@DisplayNameMethodOverride the display name in results.Filtering & Tags
@DisabledClass/MethodSkip the test/suite. Optional reason string.Filtering & Tags
@TimeoutMethodMaximum duration. value + unit (default seconds).Timeouts & Repetition
@ValueSourceMethodParameter values for @ParameterizedTest. ints, strings, doubles, etc.Parameterized Tests

Requirements

These annotations declare preconditions for test execution.
AnnotationTargetDescriptionDocs
@RequiresWorldMethodTest needs a world. Optional value for world name.World Testing
@RequiresPlayerMethodTest needs player-like context. Optional count.Command Testing
@RequiresPluginMethodTest needs a specific plugin loaded. Skipped if absent.How It Works

Lifecycle

These annotations mark setup and teardown methods.
AnnotationTargetDescriptionDocs
@BeforeAllMethodRun once before the first test. Can be static.Lifecycle Hooks
@AfterAllMethodRun once after the last test. Can be static.Lifecycle Hooks
@BeforeEachMethodRun before every test method. Instance method.Lifecycle Hooks
@AfterEachMethodRun after every test method. Instance method.Lifecycle Hooks

Usage Pattern

A typical test class uses a combination of these annotations:
@HytaleSuite(value = "My Tests", isolation = IsolationStrategy.SNAPSHOT)
@Tag("ecs")
public class MyTests {

    @BeforeAll
    static void setup() { }

    @BeforeEach
    void resetState() { }

    @HytaleTest
    @Order(1)
    @DisplayName("Component attaches correctly")
    void testComponentAttach(EcsTestContext ctx) { }

    @EcsTest
    @Order(2)
    @Timeout(value = 500, unit = TimeUnit.MILLISECONDS)
    void testFastQuery(EcsTestContext ctx) { }

    @ParameterizedTest
    @ValueSource(ints = {1, 2, 3})
    void testTiers(int tier) { }

    @HytaleTest
    @Disabled("Not yet implemented")
    void testFutureFeature() { }

    @AfterEach
    void cleanup() { }

    @AfterAll
    static void teardown() { }
}

Next Steps