Domanda

I would like to run junit test in project by gradle and store results for sonnar-runner. All junit tests are in folder called 'test' which is in root of project.

Part of sourceSets

sourceSets {
    main {
        java { srcDir 'src' }
        resources { srcDir 'src' }
        resources { srcDir 'WebContent/WEB-INF/lib' }
    }

    test {
        resources { srcDir 'test' }
    }
}

Gradle version - Gradle 1.12

When I run command: gradle test -i. I got something like this.

Skipping task ':classes' as it has no actions.
:classes UP-TO-DATE
:classes (Thread[main,5,main]) completed. Took 0.011 secs.
:compileTestJava (Thread[main,5,main]) started.
:compileTestJava
Skipping task ':compileTestJava' as it has no source files.
:compileTestJava UP-TO-DATE
:compileTestJava (Thread[main,5,main]) completed. Took 0.012 secs.
:processTestResources (Thread[main,5,main]) started.
:processTestResources
Skipping task ':processTestResources' as it is up-to-date (took 0.012 secs).
:processTestResources UP-TO-DATE
:processTestResources (Thread[main,5,main]) completed. Took 0.028 secs.
:testClasses (Thread[main,5,main]) started.
:testClasses
Skipping task ':testClasses' as it has no actions.
:testClasses UP-TO-DATE
:testClasses (Thread[main,5,main]) completed. Took 0.009 secs.
:test (Thread[main,5,main]) started.
:test
Skipping task ':test' as it has no source files.
:test UP-TO-DATE
:test (Thread[main,5,main]) completed. Took 0.01 secs.

It seems to me that tests were not found. Gradle also scan subfolders of specified folder in sourceSet, right? Where can be problem? What is your prefer way how to store test results for sonnar-runner?

È stato utile?

Soluzione

You have specified that test resources are in test but you have not specified where the test java files are, so it will default to looking for them in src/test/java

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top