Applet GUI testing automation

L

lofenee

I wonder if java.awt.robot can be used to test an applet without changing
any source code?
 
E

Evans

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.
 
A

Andrew Thompson

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.)
 
A

Andrew Thompson

...
...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. ;-)
 
L

lofenee

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.)

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?
 
A

Andrew Thompson

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.
 
A

Andrew Thompson

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.
 
A

Alex.From.Ohio.Java

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/
 
L

lofenee

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'.
 
A

Andrew Thompson

<[email protected]>
??????:c2e7e232-12b0-429b-97ca-bcda292a7...@z72g2000hsb.googlegroups.com....




...
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').
 
L

lofenee

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.
 
A

Andrew Thompson

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.
 
L

lofenee

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?
 
L

lofenee

Andrew Thompson said:
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.

Thank you.
In this case FEST may also work.
 
L

lofenee

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

Thanks a lot.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top