title: Creating JUnit report programmatically
body: <p>My current approach right now is from my application, just call the ant build and it will create the junit reports needed, but I want to have the flexibility to code junit reports programmatically.</p>
  
  <p>I tried this approach
  <a href="https://stackoverflow.com/questions/3916717/antcreate-junit-report-task-programmatically?answertab=votes#tab-top">Ant:create JUnit report task programmatically</a></p>
  
  <pre><code>FileSet fs = new FileSet();
  fs.setDir(new File(".."));
  fs.createInclude().setName("TEST-*.xml");
  XMLResultAggregator aggregator = new XMLResultAggregator();
  aggregator.addFileSet(fs);
  AggregateTransformer transformer = aggregator.createReport();
  transformer.setFormat(Format.FRAMES);
  transformer.setTodir(new File("..");
  </code></pre>
  
  <p>but I can't even get it running. Any more ideas?</p>