All Projects → SpongePowered → McTester

SpongePowered / McTester

Licence: MIT license
An integration testing framework for Minecraft

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects
typescript
32286 projects

Projects that are alternatives of or similar to McTester

Nucleus
The Ultimate Essentials Plugin for Sponge.
Stars: ✭ 144 (+269.23%)
Mutual labels:  sponge
Minefana
Bungee/Spigot plugin to send stats to a InfluxDB to be displayed by a Grafana instance.
Stars: ✭ 23 (-41.03%)
Mutual labels:  sponge
blueprint
Architectural frameworks and toolkits for bootstrapping modern Android codebases.
Stars: ✭ 57 (+46.15%)
Mutual labels:  kotlin-coroutines
Skinsrestorerx
SkinsRestorer development repository
Stars: ✭ 171 (+338.46%)
Mutual labels:  sponge
StateFlow-MVVM-MVI-demo
Using StateFlow as LiveData | StateFlow instead of LiveData | LiveData to StateFlow | StateFlow MVVM | StateFlow sample | StateFlow demo
Stars: ✭ 144 (+269.23%)
Mutual labels:  kotlin-coroutines
FoxGuard-Sponge
A Minecraft world protection plugin for SpongeAPI
Stars: ✭ 31 (-20.51%)
Mutual labels:  sponge
Viabackwards
Allows the connection of older clients to newer server versions for Minecraft servers.
Stars: ✭ 135 (+246.15%)
Mutual labels:  sponge
nytclient-android
This sample app is created to demonstrate the usage of Android Architecture Components with MVVM architecture
Stars: ✭ 24 (-38.46%)
Mutual labels:  kotlin-coroutines
the-white-rabbit
The White Rabbit is an asynchronous RabbitMQ (AMQP) client based on Kotlin coroutines
Stars: ✭ 90 (+130.77%)
Mutual labels:  kotlin-coroutines
cdi-test
JUnit extension for easy and efficient testing of CDI components
Stars: ✭ 23 (-41.03%)
Mutual labels:  junit
Craftbook
🔧 Machines, ICs, PLCs, and more!
Stars: ✭ 226 (+479.49%)
Mutual labels:  sponge
doc
QuickPerf documentation: https://github.com/quick-perf/doc/wiki/QuickPerf
Stars: ✭ 22 (-43.59%)
Mutual labels:  junit
Compressor
An android image compression library.
Stars: ✭ 6,745 (+17194.87%)
Mutual labels:  kotlin-coroutines
Worldedit
🗺️ Minecraft map editor and mod
Stars: ✭ 2,288 (+5766.67%)
Mutual labels:  sponge
Library-Spring
The library web application where you can borrow books. It's Spring MVC and Hibernate project.
Stars: ✭ 73 (+87.18%)
Mutual labels:  junit
Taskchain
TaskChain Control Flow framework. Helps facilitate running tasks on an application's "Main Thread" (such as a game), and tasks off the main (async).
Stars: ✭ 143 (+266.67%)
Mutual labels:  sponge
junit.testlogger
JUnit test logger for vstest platform
Stars: ✭ 61 (+56.41%)
Mutual labels:  junit
Delish
Delish, a Food Recipes App in Jetpack Compose and Hilt based on modern Android tech-stacks and MVI clean architecture.
Stars: ✭ 356 (+812.82%)
Mutual labels:  kotlin-coroutines
Starwars-clean
Simple project with clean architecture
Stars: ✭ 34 (-12.82%)
Mutual labels:  junit
cactoos-matchers
Elegant object-oriented hamcrest matchers
Stars: ✭ 30 (-23.08%)
Mutual labels:  junit

McTester

An integration testing framework for Minecraft

What is McTester?

McTester allows you to write fully automated integration tests against Minecraft. Through an easy-to-use API, you can direct a real single-player client to perform actions in the world (sending commands, looking around, clicking the mouse). Combined with a server-side API like Sponge, McTester allows you to write automated tests that simply wouldn't be possible otherwise.

Why not just write unit tests, and avoid the overhead of starting a full Minecraft client?

McTester is designed to complement a project's existing tests. Here are a few examples of things you can do with it:

  • Spawn in and ignite a creeper, verifying that the an explosion event is triggered within a fixed number of ticks.
  • Test that using an in-game item (such as eating an apple) causes the proper events to be fired.
  • Verify that a command block GUI always opens on the client when the player has been granted permission by a permissions plugin.

Without McTester, the only way to perform these kinds of tests is by manually running the game.
With McTester, you can run tens or hundreds of tests as part of your normal build process. You no longer have to manually test that a difficult-to-reproduce bug hasn't regressed.

How does McTester work?

McTester is implemented as a Junit @Runner. Behind the scenes, it manages three different threads:

  • The main thread, where JUnit discovers and invokes tests
  • The server thread, where most of your test code will be running.
  • The client thread, where an internal Sponge plugin executes action requets from the McTester server plugin.

ExceptionTest provides a simple example of a fully-functional McTester test.

Kotlin and coroutines

MCTester provides experimental support for writing tests using Kotlin coroutines. This allows your test to be run directly on the main thread, without needing to constantly wrap blocks of code inTestUtils.runOnMainThread.

When your test performs an action that would normally be blocking - e.g. waiting for the client to perform a right click - your test method is suspended. Once the client response reaches the server, your method is automatically scheduled back onto the main thread.

For a test writer, all of this is completely transparent. If you annotate your suspend fun with @CoroutineTest, McTester will allow you to write ordinary Kotlin code that runs on the main server thread, without freezing the game.

Custom Mixins

McTester allows custom Mixin classses to be applied before any tests are run. To use this feature, create the file META-INF/mctester/custom-mixins.properties in your project's test/resources directory. This file has one property: mixins, which is a comma-separated list of Mixin json config files. For example:

mixins=config1.json,config2.json

These mixin configs will be applied during startup, and will remain in affect for all JUnit tests classes run.

For an example, see CustomMixinsTest in this repository.


Inspired by https://github.com/vorburger/SwissKnightMinecraft/tree/master/SpongePowered/SpongeTests

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].