[JUnit] Generate an HTML report of tests

S

sylsau

Hello,

I use JUnit 4 in an Eclipse project which is built with an Ant script.
I included the junit-report Ant task in my script to generate an HTML
report of the tests executed with JUnit.

I followed the JUnit faq on the official site to configure the junit-
report task. It runs well since I obtain an HTML report like I wanted.
However, the problem is that in my report there is no name for the
tests displayed.

I haven't found the way to named my tests in the JUnit 4
documentation. This is an example of my JUnit tests :

public class UtilsTest {

// Adapter for execute Junit Test v4 in Junit Test v3
public static junit.framework.Test suite() {
return new
junit.framework.JUnit4TestAdapter(testUtils.class);
}

@Test public void testGetName1(){
String filePath = "path...";
String result = "test1";
Assert.assertTrue("Test Utils.getName 1",
result.equals(Utils.getName(filePath)));
}

@Test public void testGetName2(){
String filePath = "path2...";
String result = "test2";
Assert.assertTrue("Test Utils.getName 2",
result.equals(Utils.getName(filePath)));
}

...etc ...

}


So, someone would know how I can name my tests to generate an HTML
report with tests name ?
Or, how can I use JUnit 3 to get the same result ?

Thanks to help me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top