Running JUnit or Other Tests with Play Plugin?


(Schmitt Christian) #1

Hello, I’m trying to run play tests with gradle, my project is a multi-project build and defines multiple projects (even non play projects).

My play project (it’s a subproject, but the main project only defines an ext block, repositories, etc) contains at least:

buildscript {
repositories {
    jcenter()
    mavenLocal()
    mavenCentral()
}

dependencies {
    classpath "org.jooq:jooq-codegen:${jooqVersion}"
    classpath "org.postgresql:postgresql:${postgresqlVersion}"
    classpath 'org.iatoki:gradle-play-idea:0.4.1'
}
}

plugins {
id 'play'
id 'idea'
}

apply plugin: 'org.iatoki.play-idea'

dependencies {
    // stripped ....
    // Test
    // Not Supported: playTest "org.scalatestplus.play:scalatestplus-play_$scalaVersion:$scalatestPlayVersion"
    playTest group: 'junit', name: 'junit', version: junitVersion
    playTest "org.mockito:mockito-core:$mockitoVersion"

}

model {
    components {
        play {
            platform play: playVersion, scala: scalaVersion, java: '1.8'
            injectedRoutesGenerator = true

            sources {
                extraJava(JavaSourceSet) {
                    source.srcDir sourceDir // jooq also stripped
                }
            }

        }
    }
}

However when now running the test with either testPlayBinary or test it won’t run.
It only returns

BUILD SUCCESSFUL in 2s
7 actionable tasks: 1 executed, 6 up-to-date

Is there anything I’m missing?


(Schmitt Christian) #2

hm with gradle 3.5.1 (downgrade from 4.0) I can run the tests…