PaperMC / PaperMC/Paper

GameTest Framework Support

Open
#12,575 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

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 .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Minecraft's GameTestHelper class and the linked GameTest documentation, then compare the requested test environments, test instances, and code function tests with Paper's API bootstrap, registry, and event-lifecycle systems. Done means a decided, compatible Paper API design that exposes these GameTest capabilities without requiring NMS.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.