jjtParadox / Barometer

An old experimental test library for 1.12 MinecraftForge mods.
GNU Lesser General Public License v3.0
7 stars 3 forks source link

Barometer

Latest

An experimental test suite for MinecraftForge mods. Runs with MC 1.12 and requires ForgeGradle.

Usage

Add the following to your build.gradle in the appropriate sections:

buildscript {
    repositories {
        // ...
        // Forge's stuff here...
        // ...
        maven { url "https://dl.bintray.com/jjtparadox/MC" }
    }
    dependencies {
        // More Forge stuff
        // ...
        classpath 'com.jjtparadox.barometer:Barometer:+' // Use latest version above
    }
}

// Plugins, including 'net.minecraftforge.gradle.forge'
// ...
apply plugin: 'com.jjtparadox.barometer' // Must be after the Forge plugin

repositories {
    // Other repositories
    // ...
    maven {
        url "https://dl.bintray.com/jjtparadox/MC"
    }
}

dependencies {
    // Other dependencies
    // ...
   testCompile 'com.jjtparadox.barometer:Barometer:+' // Use latest version above
}

Add the following to the end of build.gradle:

barometer {
    testServerDir = 'testing' // Optional. Defaults to "runDir/test"

    // NOTE: By using the following statement in your code you are indicating your agreement to the Minecraft EULA (https://account.mojang.com/documents/minecraft_eula).
    acceptEula()
}

Create the directories ./src/test/java/YourModPackage for test classes.

Create JUnit tests as usual, except prepend each class with the annotation @RunWith(BarometerTester.class). Look to BarometerExampleTestJava.java for an example.

Run all tests with gradle test.

Notes: