Cyano is a testing module extracted from the Minestom fork Microtus, which has been abandoned for an indefinite period. The reasons for this abandonment are complex and will not be discussed here.
This project addresses the need for continued support of enhanced testing capabilities that were previously available in a now-abandoned fork. While Minestom has its own testing module, the fork included several improvements and quality-of-life features. Since some projects depend on these enhanced testing features, we've extracted them to this standalone repository to prevent breaking changes.
Cyano preserves all functionality from the original enhanced testing module while incorporating relevant upstream changes from Minestom. This gives you both the familiar features you depend on and the latest improvements from the main repository.
To use Cyano in your tests, you'll need to include it through your build system and use the appropriate annotation.
Integration tests with Cyano begin with this annotation:
import net.minestom.testing.extension.MicrotusExtension;
@ExtendWith(MicrotusExtension.class)
class MyTestClass {
// Your test methods here
}
The MicrotusExtension
serves as the entry point for the testing module and follows JUnit 5's extension architecture.
Important
The @ExtendWith
annotation must be placed above the class declaration, or the testing framework integration will
fail.
Cyano includes quality-of-life improvements not found in the upstream Minestom testing module. You can now create
players without specifying spawn coordinates. The system will automatically use (0, 0, 0)
as the default position.
// Creates a player that spawns at coordinates (0, 0, 0)
Player player = env.createPlayer(instance);
If you are creating a player via a TestConnection
, there is also a method which uses a default position:
// Creates a player that spawns at coordinates (0, 0, 0)
TestConnection connection = env.createConnection();
Player player = connection.connect(instance);
This simplification is particularly useful in tests where player positioning is irrelevant to the functionality being tested.
Managing test cleanup can be challenging, especially when dealing with instances that have active players. Minestom prevents instance destruction while players remain connected, which can lead to frustrating test failures.
Cyano addresses this with an enhanced destroyInstance()
method:
// Automatically removes all players before destroying the instance
env.destroyInstance(instance, true);
When the boolean parameter is set to true
, all players on the instance are automatically removed before destruction,
eliminating cleanup-related issues.
Migrating from the standard Minestom testing module to Cyano is straightforward:
- Change the annotation: Replace your existing test extension annotation with
@ExtendWith(MicrotusExtension.class)
- Optional enhancements: The new features (simplified player creation and improved cleanup) are opt-in. If you don't use them explicitly, your existing tests will continue to work with their original behavior.
Cyano maintains full backward compatibility with existing Minestom tests. Developers must explicitly use all enhanced features. The default behavior remains unchanged, ensuring your existing test suites continue to work without modification.