dcsimg
Using reflection to add test classes to the testsuite on the fly
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   deepak_saini
Posted On:   Thursday, October 11, 2007 08:42 AM

Hi, I have a TestSuite. I added some classes to this suite like this. suite.addTestSuite(AccountTest.class); suite.addTestSuite(UserTest.class); Since, the number of test classes has become quite large, I am thinking of using reflection to add test classes on the fly. For example, I have a class com.abc.AccountTest.class (I identify these class names on the fly) String classname = "com.abc.AccountTest.class" I now add this class to the testsuite. suite.addTestSuite(Class.forName(classname)); But classloader is not able to find this class and throws ClassNotFoundException. Any idea how I should proceed? -Deepak    More>>

Hi,

I have a TestSuite. I added some classes to this suite like this.

suite.addTestSuite(AccountTest.class);
suite.addTestSuite(UserTest.class);

Since, the number of test classes has become quite large, I am thinking of using reflection to add test classes on the fly.

For example, I have a class com.abc.AccountTest.class (I identify these class names on the fly)

String classname = "com.abc.AccountTest.class"

I now add this class to the testsuite.
suite.addTestSuite(Class.forName(classname));

But classloader is not able to find this class and throws ClassNotFoundException.

Any idea how I should proceed?

-Deepak

   <<Less

Re: Using reflection to add test classes to the testsuite on the fly

Posted By:   Robert_Lybarger  
Posted On:   Thursday, October 11, 2007 09:07 AM

It's telling you that it believes the class you want to load is not in the classpath. That'd be the first thing to check in your setup.
About | Sitemap | Contact