Exemplo n.º 1
0
 /**
  * When some test finished or failed. this method will be called to notify the agent that current
  * test finished.
  *
  * @param phase The actual test phase . Could be Finished or Failed.
  */
 public void notifyFinish(Phase phase) {
   this.test.setPhase(phase);
   File resultFile = null;
   for (String key : test.getResultFiles().keySet()) {
     resultFile = new File(workspace, key);
     if (!resultFile.exists()) {
       if (test.getResultFiles().get(key)) {
         p(
             "Cannot find the result File:"
                 + resultFile.getAbsolutePath()
                 + ", change result to "
                 + Phase.FAILED.toString());
         this.test.setPhase(Phase.FAILED);
         this.setFailureReason("Cannot find the result File:" + resultFile.getAbsolutePath());
         break;
       }
     }
   }
   agent.finishTest(this);
   /*File resultFile = new File(workspace, test.getResultsFilename());
   if (resultFile.exists()) {
   	agent.finishTest(this);
   } else {
   	p("Cannot find the result File:" + resultFile.getAbsolutePath() + ", change result to "
   			+ Phase.FAILED.toString());
   	this.test.setPhase(Phase.FAILED);
   	this.setFailureReason("Cannot find the result File:" + resultFile.getAbsolutePath());
   	agent.finishTest(this);
   }*/
   if (dos != null) {
     dos.remove(System.out);
   }
   CommonUtils.closeQuietly(dos);
 }