ハングするテストがある場合、結果が得られないようです。
出力をライブで見る方法はありますか?
ミーシャありがとう
これを正式に行う方法はまだわかりませんが、標準出力とエラーをリダイレクトしました:
/**
* Redirect standard output and error to appropriate files
*/
public void redirectStandardOutputAndErrorToFiles(className) {
def outFile=new File(System.getProperty("java.io.tmpdir")+File.separator+className+".out.log")
if (outFile.exists()) {
outFile.delete()
}
def errFile=new File(System.getProperty("java.io.tmpdir")+File.separator+className+".err.log")
if (errFile.exists()) {
errFile.delete()
}
def out=new PrintStream(new FileOutputStream(outFile))
def err=new PrintStream(new FileOutputStream(errFile))
System.setOut(out)
System.setErr(err)
}
次のディレクティブをテスト タスクに追加して、標準ストリームを出力するように指示できます。
build.gradle:
test {
testLogging.showStandardStreams = true
}