Skip to main content
Testing is crucial for ensuring your plugin works correctly. Paper includes a test-plugin module that demonstrates testing patterns and plugin features.

Test Plugin Structure

Paper’s test plugin is located at test-plugin/ in the Paper repository and serves as both a testing tool and example implementation.

Test Plugin Components

From the Paper test plugin source:

Manual Testing

Manual testing involves running your plugin on a Paper server and testing functionality by hand.
1

Set up test server

Create a test server directory:
2

Build and deploy plugin

Build your plugin and copy it to the test server:
3

Run the server

Start the test server:
Watch the console for:
  • Plugin loading messages
  • Any errors or warnings
  • Successful enable confirmation
4

Test functionality

Connect to the server and test:
  • Commands work correctly
  • Events fire as expected
  • Configuration loads properly
  • Permissions function correctly

Automated Testing Setup

While Paper doesn’t include a built-in testing framework, you can use standard Java testing tools.

Add Testing Dependencies

Unit Testing

Test individual components in isolation:

Testing Event Listeners

Testing Configuration

Integration Testing

Test multiple components working together:

Testing Best Practices

1. Mock External Dependencies

2. Test Edge Cases

3. Use Descriptive Test Names

4. Clean Up After Tests

Running Tests

Debugging

When debugging your plugin:
1

Enable debug logging

2

Add strategic logging

3

Use IDE debugger

Attach your IDE debugger to the running Paper server:
Then connect your IDE to port 5005.
The Paper test-plugin module serves as an excellent reference for implementing various plugin features. Examine it at test-plugin/ in the Paper repository.

Continuous Integration

Automate testing with CI/CD:
.github/workflows/test.yml
Always test your plugin thoroughly before deploying to a production server. Use a dedicated test server to avoid disrupting players.