Help, testcompile error

I’m getting this error with testcompile()

Could not find method testCompile() for arguments [junit:junit:4+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

apply plugin: "java"

apply plugin: "eclipse"

apply plugin: "idea"

compileJava.options.encoding = "UTF-8"

compileTestJava.options.encoding = "UTF-8"

repositories {

  mavenCentral()

}

dependencies {

  testCompile "junit:junit:4+"

  testImplementation "org.assertj:assertj-core:3.15.0"

}

test {

  testLogging {

    exceptionFormat = 'short'

    showStandardStreams = true

    events = ["passed", "failed", "skipped"]

  }

}
1 Like

The testCompile configuration is no longer available in the most recent versions of Gradle, and was deprecated for a long time before that. You should be using testImplementation like you have for the assertj-core dependency.