Testing Swing GUIs

Discussion in 'Java' started by Berlin Brown, Jul 19, 2005.

  1. Berlin  Brown

    Berlin Brown Guest

    What are some ways to unit test a GUI application. For example, I have
    an application that is driven by the interface, meaning all the logic
    is in the widgets. I am not used to GUI development. The only way I
    can think of testing the system is by looking at it and seeing if
    everything is where it is supposed to be.

    What are approaches out there?
    Berlin Brown, Jul 19, 2005
    #1
    1. Advertising

  2. Berlin Brown wrote:
    > What are some ways to unit test a GUI application. For example, I have
    > an application that is driven by the interface, meaning all the logic
    > is in the widgets. I am not used to GUI development. The only way I
    > can think of testing the system is by looking at it and seeing if
    > everything is where it is supposed to be.
    >
    > What are approaches out there?


    Automatic GUI testing is rather hard. Record/playback tools just bring
    you to a certain point, and many fail if you do slight adjustments in
    the GUI. Meaning that you have to record a new test case after a small
    change. This can become very frustrating, particular if you have complex
    test cases. Plan for a lot of time going into this.

    The tools usually center around java.awt.Robot. If you feel adventurous,
    you can run your own, based on that class (not recommended). Other tools
    work still below the visible GUI and e.g. feed the event queue.

    The following are free tools which I am aware of (I have no in-depth
    experience with any of these):

    http://marathonman.sourceforge.net/
    http://jemmy.netbeans.org/
    http://abbot.sourceforge.net/
    http://jfcunit.sourceforge.net/

    /Thomas


    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
    http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
    Thomas Weidenfeller, Jul 19, 2005
    #2
    1. Advertising

  3. Berlin  Brown

    Ramza Brown Guest

    Thomas Weidenfeller wrote:
    > Berlin Brown wrote:
    >
    >> What are some ways to unit test a GUI application. For example, I have
    >> an application that is driven by the interface, meaning all the logic
    >> is in the widgets. I am not used to GUI development. The only way I
    >> can think of testing the system is by looking at it and seeing if
    >> everything is where it is supposed to be.
    >>
    >> What are approaches out there?

    >
    >
    > Automatic GUI testing is rather hard. Record/playback tools just bring
    > you to a certain point, and many fail if you do slight adjustments in
    > the GUI. Meaning that you have to record a new test case after a small
    > change. This can become very frustrating, particular if you have complex
    > test cases. Plan for a lot of time going into this.
    >
    > The tools usually center around java.awt.Robot. If you feel adventurous,
    > you can run your own, based on that class (not recommended). Other tools
    > work still below the visible GUI and e.g. feed the event queue.
    >
    > The following are free tools which I am aware of (I have no in-depth
    > experience with any of these):
    >
    > http://marathonman.sourceforge.net/
    > http://jemmy.netbeans.org/
    > http://abbot.sourceforge.net/
    > http://jfcunit.sourceforge.net/
    >
    > /Thomas
    >
    >


    These look interesting.
    Ramza Brown, Jul 19, 2005
    #3
  4. Berlin  Brown

    Ramza Brown Guest

    Ramza Brown wrote:
    > Thomas Weidenfeller wrote:
    >
    >> Berlin Brown wrote:
    >>
    >>> What are some ways to unit test a GUI application. For example, I have
    >>> an application that is driven by the interface, meaning all the logic
    >>> is in the widgets. I am not used to GUI development. The only way I
    >>> can think of testing the system is by looking at it and seeing if
    >>> everything is where it is supposed to be.
    >>>
    >>> What are approaches out there?

    >>
    >>
    >>
    >> Automatic GUI testing is rather hard. Record/playback tools just bring
    >> you to a certain point, and many fail if you do slight adjustments in
    >> the GUI. Meaning that you have to record a new test case after a small
    >> change. This can become very frustrating, particular if you have
    >> complex test cases. Plan for a lot of time going into this.
    >>
    >> The tools usually center around java.awt.Robot. If you feel
    >> adventurous, you can run your own, based on that class (not
    >> recommended). Other tools work still below the visible GUI and e.g.
    >> feed the event queue.
    >>
    >> The following are free tools which I am aware of (I have no in-depth
    >> experience with any of these):
    >>
    >> http://marathonman.sourceforge.net/
    >> http://jemmy.netbeans.org/
    >> http://abbot.sourceforge.net/
    >> http://jfcunit.sourceforge.net/
    >>
    >> /Thomas
    >>
    >>

    >
    > These look interesting.
    >
    Ramza Brown, Jul 19, 2005
    #4
  5. Berlin Brown wrote:
    > What are some ways to unit test a GUI application. For example, I have
    > an application that is driven by the interface, meaning all the logic
    > is in the widgets. I am not used to GUI development. The only way I
    > can think of testing the system is by looking at it and seeing if
    > everything is where it is supposed to be.
    >
    > What are approaches out there?


    While automated GUI testing tools are useful, I think it is useful to
    separate out the widget code into the thinest possible layer. The bulk
    of your code will then be much easier to test. You'll also end up with
    higher quality code.

    Tom Hawtin
    --
    Unemployed English Java programmer
    Thomas Hawtin, Jul 19, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Big Daddy

    Java 1.2 Swing vs. Java 1.5 Swing

    Big Daddy, Apr 15, 2005, in forum: Java
    Replies:
    2
    Views:
    489
    Pete Barrett
    Apr 16, 2005
  2. mkrause
    Replies:
    0
    Views:
    662
    mkrause
    May 6, 2005
  3. lizard
    Replies:
    0
    Views:
    1,752
    lizard
    Jan 30, 2006
  4. S.T
    Replies:
    2
    Views:
    566
  5. Knute Johnson

    Swing is dead! Long live Swing.

    Knute Johnson, Feb 16, 2012, in forum: Java
    Replies:
    32
    Views:
    3,730
    Daniel Pitts
    Feb 29, 2012
Loading...

Share This Page