Loading ...
Sorry, an error occurred while loading the content.
 

Regression testing a GUI in Java

Expand Messages
  • C & C Helck
    Does anyone know how to compare a JPanel s image on the screen to a saved bitmap? The problem I have is that I have about 50 different screens most of which do
    Message 1 of 3 , Dec 1, 2001
      Does anyone know how to compare a JPanel's image on the screen to a saved
      bitmap?

      The problem I have is that I have about 50 different screens most of which
      do not change very often. I've already had a number of bugs where changes
      to one screen had unintended consequences in other seemingly unrelated
      screens -- usually related to changes in a shared widget or factory method,
      or the look and feel. It would give me a nice warm and fuzzy feeling if
      JUnit could create a screen and compare it to a known good image. Any ideas?

      -Christopher
    • r_waldhoff@hotmail.com
      ... Any ideas? ... java.awt.Robot (http://java.sun.com/j2se/1.3/docs/api/java/awt/Robot.html) may be useful. This class is used to generate native system
      Message 2 of 3 , Dec 3, 2001
        --- In extremeprogramming@y..., C & C Helck <pp002531@m...> wrote:
        > It would give me a nice warm and fuzzy feeling if
        > JUnit could create a screen and compare it to a known good image.
        Any ideas?
        >
        > -Christopher

        java.awt.Robot
        (http://java.sun.com/j2se/1.3/docs/api/java/awt/Robot.html) may be
        useful.

        "This class is used to generate native system input events for the
        purposes of test automation, self-running demos, and other
        applications where control of the mouse and keyboard is needed. The
        primary purpose of Robot is to facilitate automated testing of Java
        platform implementations.

        Using the class to generate input events differs from posting events
        to the AWT event queue or AWT components in that the events are
        generated in the platform's native input queue. For example,
        Robot.mouseMove will actually move the mouse cursor instead of just
        generating mouse move events."
      • geektank
        ... events ... Back when Robot hit the scene I played around with doing this in Java. The code is almost a year old, so I have no idea if it will work with the
        Message 3 of 3 , Dec 12, 2001
          --- In extremeprogramming@y..., r_waldhoff@h... wrote:
          > --- In extremeprogramming@y..., C & C Helck <pp002531@m...> wrote:
          > > It would give me a nice warm and fuzzy feeling if
          > > JUnit could create a screen and compare it to a known good image.
          > Any ideas?
          > >
          > > -Christopher
          >
          > java.awt.Robot
          > (http://java.sun.com/j2se/1.3/docs/api/java/awt/Robot.html) may be
          > useful.
          >
          > "This class is used to generate native system input events for the
          > purposes of test automation, self-running demos, and other
          > applications where control of the mouse and keyboard is needed. The
          > primary purpose of Robot is to facilitate automated testing of Java
          > platform implementations.
          >
          > Using the class to generate input events differs from posting
          events
          > to the AWT event queue or AWT components in that the events are
          > generated in the platform's native input queue. For example,
          > Robot.mouseMove will actually move the mouse cursor instead of just
          > generating mouse move events."


          Back when Robot hit the scene I played around with doing this in Java.
          The code is almost a year old, so I have no idea if it will work with
          the current JUnit. My UI for this is pretty clumsy, if I did it again
          I would change how I handled that. This code is probably alpha at
          best,
          but might be useful as an introduction into Robot.

          http://www.geekfarm.org/emeade/junit/GuiJunit.zip

          --
          Erik Meade emeade@...
          Senior Consultant Object Mentor, Inc.
          http://www.junit.org
        Your message has been successfully submitted and would be delivered to recipients shortly.