Hey, so heres my code:
public class NewTest extends SeleneseTestCase {
public static Test suite() throws Exception
{
TestSuite suite = new TestSuite();
TestSuite s = new TestSuite("TestCase Name");
GeneratedTest t = new GeneratedTest("testName");
t.setFailure("TestCase Name: testName");
s.addTest(t);
t = new GeneratedTest("testAge");
s.addTest(t);
suite.addTest(s);
s = new TestSuite("TestCase Name2");
t = new GeneratedTest("testOOGABOOGA");
t.setFailure("TestCase Name2: testOOGABOOGA");
s.addTest(t);
suite.addTest(s);
s = new TestSuite("TestCase Name4");
t = new GeneratedTest("testName");
t.setFailure("TestCase Name4: testName");
s.addTest(t);
t = new GeneratedTest("testAge");
s.addTest(t);
suite.addTest(s);
s = new TestSuite("TestCase Name3");
t = new GeneratedTest("testName");
t.setFailure("TestCase Name3: testName");
s.addTest(t);
t = new GeneratedTest("testAge");
s.addTest(t);
suite.addTest(s);
return suite;
}
}
public class GeneratedTest extends TestCase
{
public String testFailMessage;
public GeneratedTest(String name)
{
((TestCase)this).setName(name);
}
public void runTest()
{
if (testFailMessage != null)
{
fail(testFailMessage);
}
}
public void setFailure(String msg)
{
testFailMessage = msg;
}
}
As you can see (or maybe you can't) i'm adding tests to junit at runtime. This is all fine and dandy, except that it doesn't properly display them. Here, see what I mean:
As you can see, tests with the same name don't even display that they've been run, except for the last test with duplicate name, and that test has the error messages from all the other tests with the same name.
Is this simply just a flaw with the way that i'm doing it (junit3 style)? Would I have to change it to use junit4 parameterization to fix it?