title: Printing JUnit result to file
body: <p>I want to print the results of my JUnit tests to a <code>.txt</code> file. </p>
  
  <p>Following is my code:</p>
  
  <pre><code>try {
      //Creates html header 
      String breaks = "&lt;html&gt;&lt;center&gt;&lt;p&gt;&lt;h2&gt;"+"Test Started on: "+df.format(date)+"&lt;/h2&gt;&lt;/p&gt;&lt;/center&gt;";
  
      //Creating two files for passing and failing a test
      File pass = new File("Result_Passed-"+df.format(date)+ ".HTML");
      File failed = new File("Result_Failed-"+df.format(date)+ ".HTML");
      OutputStream fstreamF = new FileOutputStream(failed, true);
      OutputStream fstream = new FileOutputStream(pass, true);
      PrintStream p = new PrintStream(fstream);
      PrintStream  f= new PrintStream(fstreamF);
  
      //appending the html code to the two files
      p.append(breaks);
      f.append(breaks);
  
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Following is my example testcase:</p>
  
  <pre><code>public void test_001_AccountWorld1() {
  
      // Open the MS CRM form to be tested.
      driver.get(crmServerUrl + "account");
      nameOfIFRAME = "IFRAME_CapCRM";
  
      PerformCRM_World1("address1_name", "address1_name", "address1_line1", "address1_postalcode", true);
  
      assertEquals(firstLineFromForm.toString(), "");
      assertEquals(secondLineFromForm.toString(), "Donaustadtstrasse Bürohaus 1/2 . St");
      assertEquals(postcodeFromForm.toString(), "1220");       
  
  }
  </code></pre>
  
  <p>I've tried <code>p.append()</code> but doesn't work. Help please.</p>