Dynamic addition of test cases from an existing test suite to a new test suite

Suniti Ramanujam <[email protected]> Fri, 25 May 2007 18:48:53 -0700 (PDT)
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
Hello 

I have a test class defined which has a number of test cases. I would like to choose only certain test cases from this test suite dynamically. Can somebody please help me???? I tried to pass an instance of AccountTest constructor but I have trouble doing that. See below.

[Code]

< code of a generic test suite>
public class AccountTest extends TestCase{

    public AccountTest(String name)
    {
        super(name);
    }
    public void test1()
    {
    }    
    public void test2()
    {
    }
}


< Trying to add the tests dynamically>

I need to find AccountTest dynamically and then pick test1 and add it to another testsuite. This is my scenario. Can somebody please tell me how to do this??
TestSuiteClass ts = (TestSuiteClass)list.get(i);
Class tc  = ClassLoaderUtils.getClass("com.fw.testcases.smoke." + ts.testSuiteName.getContent()); // am sucessful in finding AccountTest.
...
Constructor constructor = tc.getConstructor(new Class[]{String.class}); // successful in invoking the constructor.
....
// how do I add the test to a new test suite from this constructor instance????


Thanks
KVn




       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Junit-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/junit-devel