Jump to content

[1.12.2] ./gradlew test not running unit tests


Corey

Recommended Posts

I have unit tests written for my project that I typically run through my IDE (and assumed ran automatically in my CI environment since it runs gradlew check) but it turns out running check or test isn't actually running my tests.  I have a pretty standard setup - tests are located in <project root>/src/test/java/<package>/...

 

Here's my build.gradle:

buildscript {
  repositories {
    jcenter()
    maven { url = "http://files.minecraftforge.net/maven" }
  }
  dependencies {
    classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
  }
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.

ext.configFile = file "build.properties"
configFile.withReader {
  def prop = new Properties()
  prop.load(it)
  project.ext.config = new ConfigSlurper().parse prop
}

version = config.version
group= "lordmonoxide.gradient" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "gradient"

sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
compileJava {
  sourceCompatibility = targetCompatibility = "1.8"
}

minecraft {
  version = config.mc_version + "-" + config.forge_version
  runDir = "run"

  mappings = config.mappings_version
}

repositories {
  maven {
    //IC2
    name = "player-ic2"
    url = "http://maven.ic2.player.to/"
  }

  maven {
    name = "BuildCraft"
    url = "http://www.mod-buildcraft.com/maven"
  }

  maven {
    // JEI
    name = "Progwml6 maven"
    url = "http://dvs1.progwml6.com/files/maven"
  }
}

dependencies {
  // compile against the JEI API but do not include it at runtime
  deobfProvided 'mezz.jei:jei_1.12.2:4.13.1.220:api'
  // at runtime, use the full JEI jar
  runtime 'mezz.jei:jei_1.12.2:4.13.1.220'

  testCompile "org.junit.jupiter:junit-jupiter-api:5.3.2"
}

processResources {
  // this will ensure that this task is redone when the versions change.
  inputs.property "version", project.version
  inputs.property "mcversion", project.minecraft.version

  // 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'
  }
}

 

I'm pretty unfamiliar with gradle, am I missing anything?

 

Edit: just realised there's a gradle subforum, not sure if this belongs here or there...

Edited by Corey
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.