質問

私はウィキごとのTestNG + ReportNGを使用していた命令は、Gradleの中を(デフォルトの例では、作業のフォーム私はなかったと私は料理本で固定)。

私は何とかTestNGのでコンソール出力をキャプチャしたいと思います。これは可能でしょうか?

ありがとう ミーシャ

役に立ちましたか?

解決

は[OK]を私はまだ正式にこれを行うが、私はちょうど標準出力とエラーをリダイレクトする方法はわかりません

/**
 * 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)
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top