I have one TestCase class, whcih has 5 test methods. I can directly execute this class, then all the test methods will be executed. This is fine.
Suppose If I want to execute few test methods(but not all) and those methods will be decided based on certain condition at run time, what is the solution..?
To be more clear,
I have a TestCase class "MyTestCase"
public class MyTestCase extends TestCase
{
    @Test
    public void test1()
    {
        ....
    }    
    @Test
    public void test2()
    {
        ....
    }    
    @Test
    public void test3()
    {
        ....
    }    
    @Test
    public void test4()
    {
        ....
    }      
    @Test
    public void test5()
    {
        ....
    }
}
If I run this class, all the tests will be executed.
But my requirement is: I don't want all methods to be executed always. Sometimes 2 methods or 3 methods or 4 methods etc....
I have an XML file, which decides what test methods have to be executed. Whatever is there in the XML file, only those test methods should be executed. (I have a class, which reads the XML file to get the test method names.)
Is there any way to control no of test methods to be executed in a TestCase class at run time....?
I think I have to use TestSuite class. But I am not sure on how to use it exactly. Can any one help in solving this problem...?
Thanks in advance, Sunil
 
    