2

I'm currently developing a mod that syncs player information to a database (SQL). I have deveolped the core functionality and I can release it as is, but I wish to add unit tests to make sure that any new changes dosen't destroy old functionality.

The mod currently registers a event handeler that loads player information from database when player is joining and saves the information when the player leaves.

Using github actions I was able to create a automatic workflow that will try to build the project and then try to run the server. If the serer crashes the test will fail (same for building).

Question is what would be the best way to test the new changes made so it can:

  1. Compile
  2. run on fabric server
  3. all functions such as saving to SQL db and events be tested

I have thought of adding a boolean to the code that would be set by a configuration file. I would then use the value to load in a test class that would then run some tests (Still not sure how to fake the events) but this would then be compiled into the production code.

If it is to any help the project can be found here but it is not well documanted as of now.

TLDR: How do I test code that is loaded with fabric modloader and depends on a minecraft player joining and then leaving to test the full code.

hampus toft
  • 55
  • 10

0 Answers0