1

I have a class that executes testcases. But I am facing a little problem here. After the testcases gets executed, corresponding xmls are not getting generated. I want to generate a junitreport so I require the xml files generated by junit.

public class TestRunner1 {
   public static void main(String[] args) {
      Class[] classes = { TestCase1.class ,PrimeNumberCheckerTest.class ,  TestCase2.class};
      Result result = JUnitCore.runClasses(classes);
      for (Failure failure : result.getFailures()) {
         System.out.println(failure.toString());
      }
      System.out.println(result.wasSuccessful());
     // System.out.println(result);
   }
}

can someone help?

Nishant Lakhara
  • 2,295
  • 4
  • 23
  • 46
  • How you are running JUnit TestCases i.e. through Ant Script(build.xml) or any other way? – Rahul Jan 24 '14 at 06:50
  • I am running testcases through this Runner class only. i dont want to use TestSuite class to run the cases. It is giving limitations. If ant is capable of generating xmls I am happy to use it. – Nishant Lakhara Jan 24 '14 at 07:02
  • Using this Runner class you can not generate XML report. For that you can have a look on http://stackoverflow.com/questions/14247610/after-running-junit-tests-in-eclipse-i-can-export-the-result-in-xml-format-how – Rahul Jan 24 '14 at 07:03
  • Could you explain the limitation you have to use the testSuite and/or the junit ant task? I use ant to run junit test and I never get limited. – Algiz Jan 24 '14 at 09:08
  • The limitation is that it ignores the parameterized annotations? Is there an alternate to use them with suite – Nishant Lakhara Jan 27 '14 at 10:08

0 Answers0