[英]Why does the gradle commandline do not show specs2 results?
我有一個scala項目,其中包含java項目的specs2 scalacheck規范。
我可以在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
。
Gradle(當前)不會自動識別Specs2測試,因此不會立即運行它們。 如果希望Gradle運行Specs2測試,則必須使用JUnit的@RunWith
注釋裝飾測試類,或者@RunWith
編寫指定的任務。 這兩個選項都在官方的Specs2文檔中進行了解釋 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.