testng - testng和gradle-看到死锁测试的输出了吗?

标签 testng gradle

如果我的测试挂起了,我似乎没有任何结果。

有什么办法可以实时看到输出?

谢谢
米莎

最佳答案

好的,我仍然不知道如何正式执行此操作,但是我只是重定向了标准输出和错误:

/**
 * 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/

相关文章:

android - 错误 :Execution failed for task ':app:processDebugManifest'

android - 无法找到 androidx.test.runner.AndroidJUnitRunner 的检测信息

android - 任务 ':app:transformDexWithInstantRunSlicesApkForDebug'的执行失败

android - 如何处理显然相互覆盖的gradle依赖项

android - Gradle 错误 : Write access is allowed from event dispatch thread only in Android Studio

java - 使用 testng 和 jdk1.4 手动测试类

java - 有没有办法在 TestNG 中跨测试跨越依赖关系?

java - 在运行时跳过 TestNg 测试

java - TestNG 未对单一方法的结果进行分组

java - 如何让 maven surefire 正确执行 JUnit 和 TestNG 测试?