• Es freut uns dass du in unser Minecraft Forum gefunden hast. Hier kannst du mit über 130.000 Minecraft Fans über Minecraft diskutieren, Fragen stellen und anderen helfen. In diesem Minecraft Forum kannst du auch nach Teammitgliedern, Administratoren, Moderatoren , Supporter oder Sponsoren suchen. Gerne kannst du im Offtopic Bereich unseres Minecraft Forums auch über nicht Minecraft spezifische Themen reden. Wir hoffen dir gefällt es in unserem Minecraft Forum!

Spigot MockBukkit: A Testing Framework for Minecraft Plugins

thelooter

Minecrafter
Registriert
30 Juli 2016
Beiträge
2
Diamanten
300
Minecraft
thelooter2204
logo.png
Introduction

Hey people of Minecraft! We just released version 4.0 of MockBukkit, a testing framework that makes unit testing Spigot/Paper plugins straightforward and efficient. If you've been thinking about adding tests to your plugins, now might be a great time to start!

What is MockBukkit?

MockBukkit provides mock implementations of the Bukkit API, allowing you to write unit tests for your plugins without running a server. This means you can verify your plugin's behavior quickly and reliably, just like you would with any other Java application.

Features

  • Write tests using standard tools like JUnit and Hamcrest
  • Test events, commands, and player interactions without a running server
  • Run your entire test suite in seconds
  • Simulate complex plugin scenarios easily
  • Clear, comprehensive documentation at docs.mockbukkit.org

Example
Java:
@Test
void playerJoinsServer() {
    // Create a test plugin
    TestPlugin plugin = MockBukkit.load(TestPlugin.class);
  
    // Simulate a player joining
    PlayerMock player = server.addPlayer();
  
    // Verify your plugin's behavior
    assertThat(player.getGameMode(), is(GameMode.SURVIVAL));
    assertThat(player.getInventory(), hasItem(Material.COMPASS));
}


Getting Started

Check out our website at mockbukkit.org and our docs.mockbukkit.org to get started. If you need help, feel free to join our Discord community!

Lastly

We hope you enjoy using MockBukkit 4.0 and we look forward to your feedback!


 
Oben