From: <mee...@wi...> - 2004-05-26 11:22:03
|
Hi, =20 I tried testing swing application using JFC unit.I have a class named myclass.The class has a textbox and a button named mybutton. I have a test class Testmyclass ,which checks for the existence of a button in myclass.I used findNamedComponent () method .But my testcase fails. Please let me know how to use this method findNamedComponent(). Let's say my testclass looks like this, import junit.extensions.jfcunit.*; import junit.extensions.jfcunit.JFCTestCase; import junit.extensions.jfcunit.TestHelper; import junit.extensions.jfcunit.JFCTestHelper; Class Testmyclass extends TestCase{ private myclass mi=3D null; private JButton clickme=3Dnull; private JFCTestHelper helper =3D null; =20 =20 =20 public Testmyclass( String name ) { =20 super( name ); =20 } =20 protected void setUp() throws Exception { helper =3D new JFCTestHelper(); =20 =20 =20 clickme=3D(JButton) helper.findNamedComponent(myclass.class,"mybutton",0);=20 System.out.println(clickme); =20 System.out.println("iN setup"); flushAWT(); =20 } public void testnotnull() throws Exception{ assertNotNull("Not found ",clickme); //fails=20 } protected void tearDown() throws Exception{ super.tearDown(); System.out.println("In tear down"); } } Please help. Meera Ramachandran =20 |