to run single test in junit 4 from a main method

inba <[email protected]> Tue, 1 Feb 2011 08:31:01 -0800 (PST)
Newsgroups gmane.comp.java.junit.devel
Message-ID <[email protected]>
public class TESTCLASS  {	
	
	@Before
	public void setUp(){
		//some setup
	}
	
	@Test
	public void testA() {
		//some test
	}
	
	@Test
	public void testB(){
		//some test
	}

        @Test
	public void testB(){
		//some test
	}
}

To run a single method testB in the above class I have code in a main() as
below 

new TestRunner().start(new
String[]{"-c","TESTCLASS","-m","TESTCLASS.testB"}); 


but this doesn't work and i get an error like this 

Exception in thread "main" java.lang.Exception: Could not create and run
test suite: java.lang.ClassCastException: class TESTCLASS at
junit.textui.TestRunner.start(TestRunner.java:182) 



I am trying to execute a method selected in a swing application. At the end
i would want to get a list of selected methods in the swing gui to be
executed. how do i do this ?


-- 
View this message in context: http://old.nabble.com/to-run-single-test-in-junit-4-from-a-main-method-tp30814050p30814050.html
Sent from the JUnit - Dev mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d