如果我的测试挂起了,我似乎没有任何结果。
有什么办法可以实时看到输出?
谢谢
米莎
最佳答案
好的,我仍然不知道如何正式执行此操作,但是我只是重定向了标准输出和错误:
/**
* 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)
}
关于testng - testng和gradle-看到死锁测试的输出了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3030438/