spock レポート拡張機能 ( https://github.com/renatoathaydes/spock-reports )を使用して HTML レポートを生成するにはどうすればよいですか。build.gradle ファイルに依存関係を追加しました。これは、私が知る限り、私がする必要がある唯一のことです。しかし、Eclipse でテストを実行すると、レポートがどこにも表示されません。
これが私の build.gradle ファイルです。spock レポートの依存関係は最後にあります。
apply plugin: 'java-library'
apply plugin: 'groovy'
repositories {
jcenter()
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
implementation 'com.google.guava:guava:22.0'
testImplementation 'org.codehaus.groovy:groovy-all:2.4.11'
testImplementation 'org.spockframework:spock-core:1.0-groovy-2.4'
testImplementation 'junit:junit:4.12'
testCompile( 'com.athaydes:spock-reports:1.3.1' ) {
transitive = false // this avoids affecting your version of Groovy/Spock
}
testCompile 'org.slf4j:slf4j-api:1.7.13'
testCompile 'org.slf4j:slf4j-simple:1.7.13'
}
編集: build.gradle ファイルが間違っています。
「gradle init --type java-library --test-framework spock」を使用してビルドを生成しましたが、これは正常に機能し、Groovy クラスをいくつか追加して、Eclipse でテストを正常に実行できましたが、「Groovy クラス パスを推測できないため、Groovy クラス パスを推測できません」というメッセージが表示されました。 no Groovy Jar was found on class path [...]" gradle.build を使用しようとしたときにエラーが発生しました。
Groovy の依存関係を「testImplementation」から「compile」に変更しました。プロジェクトがコマンドラインからテストをコンパイルして実行できるようにしました。これにより、スポック レポートも生成されました。
Eclipse でテストを実行しても、テスト レポートは生成されません。
この build.gradle ファイルを使用して、コマンド ラインから新しいプロジェクトをビルドします。
apply plugin: 'groovy'
apply plugin: 'java-library'
repositories { jcenter() }
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.11'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile( 'com.athaydes:spock-reports:1.3.1' ) {
transitive = false // this avoids affecting your version of Groovy/Spock
}
testCompile 'org.slf4j:slf4j-api:1.7.13'
testCompile 'org.slf4j:slf4j-simple:1.7.13'
}
そして、同じgroovyファイルをコピーしました。次に、プロジェクトをEclipseにインポートしました。これは、Eclipse からテストを実行するときに機能します (spock レポートを生成します)。問題の正確な内容はまだわかりませんが、問題は解決したと思います。