Posted October 14, 201411 yr I've been trying to get JUnit tests to run with Forge Gradle (1222), but I can't seem to get anything to work, and external resources are not helpful at all. Situation: I have a class that needs testing, so I auto-generated a JUnit 4 test class, which ended up in the test packages folder. Problem: - JUnit jar is not recognized, therefore test classes won't compile. - Adding JUnit dependency manually according to the gradle guide doesn't work even the slightest. How do I add JUnit jars to the test build properly so I can run the test case? My Mods New Dawn - A completely new terrain engine for Minecraft TwoTility - Blocks and Items for a better Minecraft TwoGraves - Keeps your items safe on death
October 14, 201411 yr Author If I try to add the very same line as you have, I get the following error: * What went wrong: A problem occurred evaluating root project 'mc-forge-1710-mapwriter'. > Could not find method testCompile() for arguments [junit:junit:4.11] on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@ff5762d. My Mods New Dawn - A completely new terrain engine for Minecraft TwoTility - Blocks and Items for a better Minecraft TwoGraves - Keeps your items safe on death
October 14, 201411 yr Author One build.gradle coming up: buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' testCompile "junit:junit:4.11" } } apply plugin: 'forge' version = '3.1710.0' group = 'mapwriter' archivesBaseName = 'MapWriter' minecraft { version = '1.7.10-10.13.1.1222' assetDir = "run/assets" runDir = "run" } processResources { // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } jar { //classifier = 'universal' version = "${project.minecraft.version}-${project.version}" } task sourceJar(type: Jar) { from sourceSets.main.allSource classifier = 'sources' version = "${project.minecraft.version}-${project.version}" } task deobfJar(type: Jar) { from sourceSets.main.output classifier = 'deobf' version = "${project.minecraft.version}-${project.version}" } artifacts { archives sourceJar, deobfJar } My Mods New Dawn - A completely new terrain engine for Minecraft TwoTility - Blocks and Items for a better Minecraft TwoGraves - Keeps your items safe on death
October 14, 201411 yr Author That did it, thank you very much. =) My Mods New Dawn - A completely new terrain engine for Minecraft TwoTility - Blocks and Items for a better Minecraft TwoGraves - Keeps your items safe on death
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.