Applet GUI testing automation

Discussion in 'Java' started by lofenee, Jul 16, 2008.

  1. lofenee

    lofenee Guest

    I wonder if java.awt.robot can be used to test an applet without changing
    any source code?
    lofenee, Jul 16, 2008
    #1
    1. Advertising

  2. lofenee

    Evans Guest

    On 16 Jul, 10:42, "lofenee" <> wrote:
    > I wonder if java.awt.robot can be used to test an applet without changing
    > any source code?


    'without changing any source code?' what does that mean?

    Yes, you can use robot class to test your GUI if you want, but there
    are other tools on the market for GUI testing. A google search will
    spit out hundreds.

    --
    Evans
    http://www.javawug.org
    Evans, Jul 16, 2008
    #2
    1. Advertising

  3. On Jul 16, 7:42 pm, "lofenee" <> wrote:
    > I wonder if java.awt.robot can be used to test an applet without changing
    > any source code?


    Do you?

    Can the applet be loaded in the AppletViewer?

    (If the answer to my second question is 'yes', then
    the answer to your question is certainly 'yes'. My
    first suggestion might have been 'dump Robot for
    JUnit or JFCUnit', but it seems they cannot handle
    applets.)

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #3
  4. On Jul 16, 7:57 pm, Evans <> wrote:
    > On 16 Jul, 10:42, "lofenee" <> wrote:
    >...
    > 'without changing any source code?' what does that mean?


    I expect the OP is referring to the applet itself.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #4
  5. lofenee

    Evans Guest


    > > 'without changing any source code?' what does that mean?

    >
    > I expect the OP is referring to the applet itself.
    >
    > --
    > Andrew Thompsonhttp://pscode.org/


    Thanks Andrew, just got in the office - still haven't had my morning
    coffee :)

    --
    Evans
    http://www.javawug.org
    Evans, Jul 16, 2008
    #5
  6. On Jul 16, 8:56 pm, Evans <> wrote:
    > > > 'without changing any source code?' what does that mean?

    >
    > > I expect the OP is referring to the applet itself.

    ...
    > ...just got in the office - still haven't had my morning
    > coffee :)


    Don't sweat it. The OP can always apply for a
    'full refund' if they are dissatisfied with any
    answers they receive. ;-)

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #6
  7. lofenee

    lofenee Guest

    >Do you?

    By 'without changing any source code', I mean no need to add extra code
    to the applet or even to change it to an application.

    >Can the applet be loaded in the AppletViewer?


    >(If the answer to my second question is 'yes', then
    >the answer to your question is certainly 'yes'. My
    >first suggestion might have been 'dump Robot for
    >JUnit or JFCUnit', but it seems they cannot handle
    >applets.)


    >--
    >Andrew Thompson
    >http://pscode.org/


    Is there any difference from applet being loaded by the browser
    while loaded in the AppletViewer?
    If there is no significant difference, my anwser is yes.

    If the applet is loaded in the AppletViewer, can Robot obtain
    the handler of it?
    lofenee, Jul 16, 2008
    #7
  8. On Jul 16, 10:44 pm, "lofenee" <> wrote:
    ...
    > Is there any difference from applet being loaded by the browser
    > while loaded in the AppletViewer?


    Yes. I have just been developing applets that
    use the JSObject that simply do not work in the
    AppletViewer. There are a lot of other reasons
    applets might fail in the AV, but perhaps you can
    'short circuit' the entire Q/A process by actually
    testing the applet (to which you have not provided
    an URL) in the AV yourself.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #8
  9. On Jul 16, 10:44 pm, "lofenee" <> wrote:
    ..
    > If the applet is loaded


    (presumably - successfully)

    >..in the AppletViewer, can Robot obtain
    > the handler of it?


    I am not sure what you mean by 'handler'*.

    The original point I wanted to make is simply that
    you might *if necessary* load the applet (for whose
    code we do not even have, let alone can change) in a
    'helper' applet that ensures the AppletViewer is in a
    fixed location/size to allow the Robot to do its work.

    Explain what you mean by 'handler' and I might go
    into more detail.

    * An SSCCE often helps me understand.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #9
  10. lofenee

    Guest

    On Jul 16, 5:42 am, "lofenee" <> wrote:
    > I wonder if java.awt.robot can be used to test an applet without changing
    > any source code?


    Robot can be used to test anything which involves mouse, keyboard and
    screen. It, actually, takes control over your mouse, keyboard and have
    ability to have screen shots. It's your real mouse, not mouse inside
    Applet or your Java application.
    You can even write your own VNC server using Robot.

    Unfortunately, allowing computer to have control over your mouse/
    keyboard is not good idea. That's the reason why Robot is not used for
    tests.

    Alex.
    http://www.myjavaserver.com/~alexfromohio/
    , Jul 16, 2008
    #10
  11. lofenee

    lofenee Guest

    <>
    ??????:...
    > On Jul 16, 5:42 am, "lofenee" <> wrote:
    >> I wonder if java.awt.robot can be used to test an applet without changing
    >> any source code?

    >
    > Robot can be used to test anything which involves mouse, keyboard and
    > screen. It, actually, takes control over your mouse, keyboard and have
    > ability to have screen shots. It's your real mouse, not mouse inside
    > Applet or your Java application.
    > You can even write your own VNC server using Robot.
    >
    > Unfortunately, allowing computer to have control over your mouse/
    > keyboard is not good idea. That's the reason why Robot is not used for
    > tests.
    >
    > Alex.
    > http://www.myjavaserver.com/~alexfromohio/


    I don't know what Robot class you referenced.
    As I know, there is a class java.awt.robot, which can locate a swing frame
    by a title name and
    the widgets(button, check button) in the frame. So I think it's different
    from your 'Robot'.
    lofenee, Jul 16, 2008
    #11
  12. On Jul 16, 11:34 pm, "lofenee" <> wrote:
    > <>
    > ??????:....
    >
    >
    >
    > > On Jul 16, 5:42 am, "lofenee" <> wrote:
    > >> I wonder if java.awt.robot can be used to test an applet without changing
    > >> any source code?

    >
    > > Robot can be used to test anything which involves mouse, keyboard and
    > > screen. It, actually, takes control over your mouse, keyboard and have
    > > ability to have screen shots. It's your real mouse, not mouse inside
    > > Applet or your Java application.
    > > You can even write your own VNC server using Robot.

    >
    > > Unfortunately, allowing computer to have control over your mouse/
    > > keyboard is not good idea. That's the reason why Robot is not used for
    > > tests.

    ...
    > I don't know what Robot class you referenced.


    You mention again something I meant to mention earlier.
    ...

    > As I know, there is a class java.awt.robot, ...


    No, there is no such thing. By Sun's common
    nomenclature, you would be referring to a package
    if mentioning a lower case 'r'.

    My entire earlier replies were based on the
    assumption that you actually meant..
    'java.awt.Robot' (note the capital 'R').

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #12
  13. lofenee

    lofenee Guest

    >I am not sure what you mean by 'handler'*.

    As following code,
    Frame jframe=getFrame("test");;
    JButton jbtn=getButton(jframe,"jButton1");


    I regard jframe as a handler of the Frame.
    lofenee, Jul 16, 2008
    #13
  14. On Jul 16, 11:49 pm, Andrew Thompson <> wrote:
    ...
    > My entire earlier replies were based on the
    > assumption that you actually meant..
    > 'java.awt.Robot' (note the capital 'R').


    ..and (java.awt.)Robot was the class that alex.from.ohio
    was writing about.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #14
  15. On Jul 16, 11:54 pm, "lofenee" <> wrote:
    > >I am not sure what you mean by 'handler'*.

    >
    > As following code,
    > Frame jframe=getFrame("test");;
    > JButton jbtn=getButton(jframe,"jButton1");
    >
    > I regard jframe as a handler of the Frame.


    OK - sure. The AppletViewer itself will generally
    have an 'unknown and inscrutable' name. But this
    is where the intermediate 'testing' applet comes
    into play (did I mention that before?).

    It works like this.

    A 'womb' applet loads the applet we need to test.

    The womb applet is loaded in applet viewer and
    thereafter loads the applet we want to test, but
    it has important roles. One of them would be to
    obtain a reference to the (J)Frame that is the
    AppletViewer.

    This allows the loader applet to set the title of
    the frame to something that the Robot can identify.

    Once that reference is obtained, you might handle
    the testing in the 'normal way', though perhaps
    with some slight variation,s given the Test applet
    is an applet hosted within another applet.

    --
    Andrew Thompson
    http://pscode.org/
    Andrew Thompson, Jul 16, 2008
    #15
  16. lofenee

    lofenee Guest

    > As I know, there is a class java.awt.robot, ...

    >No, there is no such thing. By Sun's common
    >nomenclature, you would be referring to a package
    >if mentioning a lower case 'r'.


    >My entire earlier replies were based on the
    >assumption that you actually meant..
    >'java.awt.Robot' (note the capital 'R').


    Sorry for my typo and also for my misunderstanding.
    Alex is right.

    Then is there any appropriate way to automate testing
    the applet?
    lofenee, Jul 16, 2008
    #16
  17. lofenee

    lofenee Guest

    "Andrew Thompson" <>
    ??????:...
    >OK - sure. The AppletViewer itself will generally
    >have an 'unknown and inscrutable' name. But this
    >is where the intermediate 'testing' applet comes
    >into play (did I mention that before?).
    >
    >It works like this.
    >
    >A 'womb' applet loads the applet we need to test.
    >
    >The womb applet is loaded in applet viewer and
    >thereafter loads the applet we want to test, but
    >it has important roles. One of them would be to
    >obtain a reference to the (J)Frame that is the
    >AppletViewer.
    >
    >This allows the loader applet to set the title of
    >the frame to something that the Robot can identify.
    >
    >Once that reference is obtained, you might handle
    >the testing in the 'normal way', though perhaps
    >with some slight variation,s given the Test applet
    >is an applet hosted within another applet.
    >
    >--
    >Andrew Thompson
    >http://pscode.org/


    Thank you.
    In this case FEST may also work.
    lofenee, Jul 17, 2008
    #17
  18. lofenee

    lofenee Guest

    Is there any way without loading applet by AppletViewer?
    That is, the applet shall be loaded by the browser.

    Thanks a lot.
    lofenee, Jul 18, 2008
    #18
    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. ECS Automation Administrator

    ECS: Elements of C++ Style Automation Testing

    ECS Automation Administrator, Nov 16, 2004, in forum: C++
    Replies:
    0
    Views:
    325
    ECS Automation Administrator
    Nov 16, 2004
  2. Replies:
    0
    Views:
    765
  3. apondu
    Replies:
    0
    Views:
    573
    apondu
    Jul 19, 2007
  4. Lucas Winstanley
    Replies:
    1
    Views:
    484
    Roger Pack
    Jan 8, 2009
  5. Cristina
    Replies:
    2
    Views:
    117
    Nate St.Germain
    Jul 16, 2010
Loading...

Share This Page