I worked on a project in which testclasses are run via JunitCore.run(testClasses) not via Ant because I have to run the project even with no ANT framework (so no Testng for the same reason). But I still need to create html and xml reports same as JUNIT/ANT. How to generate them in my case?
Right now I found https://github.com/barrypitman/JUnitXmlFormatter/blob/master/src/main/java/barrypitman/junitXmlFormatter/AntXmlRunListener.java may be used to generate xml report. How do I generate html similar to junit-noframes.html? Are there existing methods to convert the TESTS-TestSuites.xml to junit-noframes.html and how? if not, how to generate the html? I do not even find the standard of the html format.
1) Write a test class
2)Create a class which extends RunListner:
3) Generate the report.
4) Finally our report is ready
I hope it helps you!
In fact I solved the problem myself in this way:
First I use https://code.google.com/p/reporting-junit-runner/source/browse/trunk/src/junitrunner/XmlWritingListener.java?spec=svn2&r=2 to create TESTS-*.xml Then I write the following code myself to create TEST-SUITE.xml and junit-noframes.html. The idea is make use of API of ANT to create reports without really running test. so far the solution works for me.