Help please: testing modal dialog

  • whoknew99

    whoknew99 - 2006-10-18

    I am sure this has been answered before so I apologize in advance.  BTW I did look at the FAQ and searched this forum FWIW.

    I am trying to write code using Abbot to test my GUI's modal logon screen (fixture/Foo).  Although I am creating and showing my modal dialog in a separate thread, I always get this in my test after calling JButtonTester.actionClick (I never get to 'Made it here'):
    abbot.tester.ActionFailedException: Could not make visible by scrolling the point (52,12) on javax.swing.JButton[signOnButton,240,15,105x25,invalid,layout=javax.swing.OverlayLayout,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@45378f,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Sign On,defaultCapable=true]

    I am pretty sure that this means the dialog is not visible.  However I am confused as I am calling setVisible(true) on it.

    So what is going on?

    Thanks in advance,



    public class FooTest extends ComponentTestFixture {

        protected void setUp() throws Exception {
                    fixture = new Foo("Test");
        protected void tearDown() throws Exception {
            fixture = null;
        public void testUserAndPasswordEmpty() {

            Runnable r = new Runnable() {
                public void run() {
            Thread t = new Thread(r);
                JButton signOnButton = null;
                try {
                    signOnButton = (JButton) getFinder().find(new NameMatcher(Foo.SIGNON_BTN_NAME));
                } catch (MultipleComponentsFoundException mcfe) {
          "caught exception: " + mcfe.getClass().getName() + ". message:" + mcfe.getMessage());
                } catch (ComponentNotFoundException cnfe) {
          "caught exception: " + cnfe.getClass().getName() + ". message:" + cnfe.getMessage());

                JButtonTester signOnTester = new JButtonTester();
                System.out.println("Made it");

    • whoknew99

      whoknew99 - 2006-10-19

      I have everything working now so please don't spend any time on this.  Thanks!

      • A. E. Walker

        A. E. Walker - 2007-11-01

        How did you resolve this issue?

    • Mary-Anne Wolf

      Mary-Anne Wolf - 2009-01-30

      I can only guess, but when I am testing a dialog,
      I find that it may not be visible immediately after I call setVisible,
      so I need to loop until JDialog.isVisible is true,
      and only treat the JDialog as visible after that loop finishes.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks