mercredi 28 septembre 2016

gradle compiles but does not run tests

I'm trying to create a new gradle project for just testing some code but I can't run the test cases.

My folder structure looks like this:

- src
    - main
        - groovy
        - java
        - resources
    - test
        - groovy
        - java
        - resources

My build.gradle:

group 'test'
version '1.0-SNAPSHOT'

apply plugin: 'groovy'

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.codehaus.groovy:groovy-all:2.3.11'
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

and a test, that is in src/test/groovy:

import groovy.util.logging.Log
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@Log
@RunWith(JUnit4.class)
class TestA {
    TestA() {
        println "hello"
    }

    @Test
    void "test"() {
        println "a"
        log.info("b")
    }
}

When I'm running ./gradlew.bat test through the command line I get this:

{ test }  » ./gradlew.bat test
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy
:processTestResources UP-TO-DATE
:testClasses
:test

BUILD SUCCESSFUL

Total time: 5.333 secs

Everything should be right but nothing gets printed and I don't know why.

Aucun commentaire:

Enregistrer un commentaire