如果文件已经存在,先删除,然后向文件中追加失败信息

if(maxRecordFail>0){
    def testResultFile = new File(projectDir+"\\TestResult\\PA_Integration Testing\\"+ currentStepName+".txt")  
     if (testResultFile.exists()) {
         testResultFile.delete()
     }
    for(j=0; j<maxRecordFail; j++){
        String currentFailMessage = failMessageList.get(j)
        log.error currentFailMessage
        testResultFile.append(currentFailMessage+"\n" )
    }
    assert false,failMessageList.get(0)
}    

  

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2022-01-13
  • 2021-05-30
  • 2021-09-12
相关资源
相似解决方案