我想通过gradle在项目中运行junit test并为sonnar-runner存储结果。所有junit测试都在名为' test'的文件夹中。这是项目的根源。
sourceSets的一部分
sourceSets {
main {
java { srcDir 'src' }
resources { srcDir 'src' }
resources { srcDir 'WebContent/WEB-INF/lib' }
}
test {
resources { srcDir 'test' }
}
}
Gradle版本 - Gradle 1.12
当我运行命令时:gradle test -i
。我有这样的事情。
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.
在我看来,没有找到测试。 Gradle还扫描sourceSet中指定文件夹的子文件夹,对吗?哪里可以有问题? 您更喜欢如何存储sonnar-runner的测试结果?
答案 0 :(得分:1)
您已指定测试resources
位于test
,但您尚未指定测试java
文件的位置,因此默认情况下会在src/test/java
中查找