2

I have to automate a swing application.I created a sample swing application to know the functionality of the UISpec4j jar.I have written a small test to just enter the text in the text field and click the button.

The code that I wrote for testing is as follows:

public class SwingTest extends UISpecTestCase
{
    private MainClassAdapter adapter;
    static {
        UISpec4J.init();
    }

     protected void setUp() throws Exception {
        setAdapter(adapter);
    }

     public interface UISpecAdapter {
        Window getMainWindow();
    }

    public  void test()
    {
        Window mainWindow = getMainWindow();
        mainWindow.getTextBox("eFirstName").setText("x");
        mainWindow.getTextBox("eLastName").setText("y");
        mainWindow.getButton("btnClick").click();
    }

    public static void main(String[] args)
    {
        SwingTest x=new SwingTest();
        x.test();
    }
}

But it doesn't do anything.I dont know why it doesn't work.Could anybody tell where m doing it wrong.

Java Devil
  • 10,629
  • 7
  • 33
  • 48
dithi
  • 21
  • 2

0 Answers0