我有一個scala項目,其中包含一個java項目的specs2 scalacheck規範。爲什麼gradle命令行不顯示specs2結果?
我能夠與運行在Eclipse中JUnitRunner和所有測試通過的規範。
我也可以執行gradle測試任務,但我沒有看到有關測試的任何控制檯輸出。
這是我的build.gradle
文件:
apply plugin: 'scala'
apply plugin: 'eclipse'
ext {
scalaVersion = "2.11.+"
specs2ScalaVersion = "2.11"
specs2ScalacheckVersion = "3.1.1"
dependencyJunit = "junit:junit:4.+"
}
sourceCompatibility = 1.8
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'camm-shared specs',
'Implementation-Version': version
}
}
repositories {
maven { url "http://dl.bintray.com/scalaz/releases" }
mavenCentral()
}
dependencies {
compile "org.scala-lang:scala-library:$scalaVersion"
compile files('../lib/MarketInterface.jar')
compile project(':camm-shared')
testCompile "org.specs2:specs2-core_$specs2ScalaVersion:$specs2ScalacheckVersion"
testCompile "org.specs2:specs2-scalacheck_$specs2ScalaVersion:$specs2ScalacheckVersion"
testCompile "org.specs2:specs2-junit_$specs2ScalaVersion:$specs2ScalacheckVersion"
testCompile dependencyJunit
}
test {
//makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
}
test {
onOutput { descriptor, event ->
logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message)
}
}
我已經嘗試建議通過配置測試任務來獲取控制檯輸出,但沒有解決問題。
當我清理項目並運行測試任務時,它需要應用程序。 20秒,所以它可能運行所有的測試,這不會失敗。他們在Eclipse中的JUnitRunner也需要大約20秒 - 我有minTestOk = 100000
。
你弄清楚如何讓這個工作?我用@RuNWith等裝飾了我的測試類,但仍然沒有看到任何輸出。此答案中的鏈接爲 –