1

ハングするテストがある場合、結果が得られないようです。

出力をライブで見る方法はありますか?

ミーシャありがとう

4

2 に答える 2

1

これを正式に行う方法はまだわかりませんが、標準出力とエラーをリダイレクトしました:

/**
 * 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)
}
于 2010-06-13T00:02:39.983 に答える
0

次のディレクティブをテスト タスクに追加して、標準ストリームを出力するように指示できます。

build.gradle:

test {
    testLogging.showStandardStreams = true
}
于 2015-01-18T12:41:06.683 に答える