Skip to content

GameTest Framework Support #12575

@akarahdev

Description

@akarahdev

Is your feature request related to a problem?

Currently, PaperMC doesn't support the game test framework. This would allow plugins to have unit-tests to make sure certain behaviors work.

I'll make a quick example, imagine you're working on a plugin that gives mobs levels when they spawn in, so they can be procedurally more challenge. You could then create a game test that spawns a zombie (or some other mob), gives it a level, lets the plugin give it equipment, then check it's equipment.

Describe the solution you'd like.

I think PaperMC should provide API support for the GameTest framework in Minecraft. I don't think it has to mirror the internals exactly, but some sense of compatibility would be nice.

During bootstrapping, you should be able to define:

  • Test environments
  • Test instances
  • Code function tests

Test environments & test instances should probably be exposed through PaperMC's registry system & event lifecycle systems. Code function tests could be registered similarly, but I think the Code Function registry should be based off a Functional Interfaces (so you can use lambdas and define them inline if you'd like).

Describe alternatives you've considered.

You could manually write the tests yourself, but that has a few issues:

  • You have to provide the framework yourself
  • It (probably) wouldn't integrate nicely into Minecraft's built-in tests.

You could also use NMS, but NMS as far as I'm aware is unsupported officially, and Paper's API should be used wherever possible.

Other

This is natively supported in Minecraft:

This issue would also solve #12331 .
As far as I can tell, this is currently not in the 1.21.5 Todo list at #12289 .

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions