|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--PGUICapture
PGUI - PhOSCo GUI Testing Copyright (C) 2000 Mike Calder-Smith, mike@gmot.demon.co.uk Guillemot Design Ltd - www.PhOSCo.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The PhOSCo GUI Test Robot is a very easy to use tool for testing the Graphical User Interface (GUI) behaviour of Java applications. It consists of two programs and one helper class:
For documentation, see the PGUI user documentation .
This is a very initial release with minimal testing, but does work. Please let the author know of any problems. Improvements and adaptations welcomed.
This code requires Java 1.3 to compile, and the availability of the com.sun.image.codec.jpeg extensions from the Sun JDK 1.3 or JRE.
This routine is used in testing the GUI interface of Java programs. It is the utility which captures key and mouse events to file.
Events are recorded to the file named in the runtime parameter supplied at program start. The program itself prompts for the tested process invocation string.
The Standard Output and Standard Error streams of the tested process are redirected to files.
Inner Class Summary | |
private class |
PGUICapture.WriteProcessOutput
Class to write an output stream of the tested process to a file. |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
(package private) int |
autodelayint
Test parameter - auto delay interval |
(package private) byte[] |
buf
Instrumentation Datagram Packet Buffer |
(package private) int |
buttonmask
Test parameter - mouse button mask |
(package private) static int |
COMMENT
Test Code |
(package private) static java.lang.String |
copyr
Copyright |
(package private) static int |
DELAY
Test Code |
(package private) static java.lang.String |
DM
Drag Mouse standard message |
(package private) java.net.DatagramPacket |
dpckt
Instrumentation Datagram Packet |
(package private) java.net.DatagramSocket |
ds
Instrumentation Datagram Socket |
(package private) boolean |
eatingDrags
Flag for Mouse Drag in process. |
(package private) int |
keycode
Test parameter - Key code |
(package private) java.lang.String |
lastDragMsg
Last Drag message read by logPrint() |
(package private) java.lang.String |
lastLogMsg
Log message written by logPrint() |
protected static java.io.PrintStream |
log
Log file |
(package private) static java.lang.String |
MM
Move Mouse standard message |
private static int |
mouse_x
Test parameter - mouse x coordinate |
private static int |
mouse_y
Test parameter - mouse y coordinate |
(package private) static int |
MOUSECLICK
Test Code |
(package private) static int |
MOUSEDBLCLICK
Test Code |
(package private) static int |
MOUSEMOVE
Test Code |
(package private) boolean |
mouseMoveEaten
Mouse move eaten flag |
(package private) boolean |
mouseReleased
Mouse Released Flag |
(package private) java.io.BufferedInputStream |
processErrors
Error Output Stream produced by the tested process |
(package private) java.io.BufferedInputStream |
processOutput
Standard Output Stream produced by the tested process |
(package private) int |
savedMods
Saved Button Mask |
(package private) static java.lang.String |
SET
Set meta key standard message |
(package private) static int |
SETAUTODELAY
Test Code |
(package private) static int |
SETMODEKEY
Test Code |
private int |
sheight
Tested Process Screen Height |
(package private) boolean |
shiftlock
Shift lock |
(package private) int |
sleeptime
Test parameter - delay interval |
private int |
sox
Tested Process Screen X Origin |
private int |
soy
Tested Process Screen Y Origin |
private int |
swidth
Tested Process Screen Width |
(package private) static java.lang.Process |
thisProc
The tested process |
(package private) static int |
TYPEKEY
Test Code |
(package private) static java.lang.String |
UNS
UnSet meta key standard message |
(package private) static int |
UNSETMODEKEY
Test Code |
(package private) boolean |
verboseMouse
Verbose Mouse flag (if true, lots of Mouse moves; otherwise compacted). |
(package private) static java.lang.String |
version
Version |
Fields inherited from class java.awt.Component |
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
PGUICapture()
Constructor |
Method Summary | |
private int |
getClickCount(java.lang.String dmsg)
Get Click Count from Datagram message |
private void |
getData()
Listen for Datagrams from the tested process, and send to the appropriate handler. |
private int |
getKeyCode(java.lang.String dmsg)
Get Keycode from Datagram message |
private int |
getMods(java.lang.String dmsg)
Get Modifiers from Datagram message |
private java.awt.Point |
getPoint(java.lang.String dmsg)
Get Coordinate point from Datagram message |
private void |
handleKeyEvent(java.lang.String dmsg)
Handle Datagram message about Key event |
private void |
handleMouseEvent(java.lang.String dmsg)
Handle Datagram message about Mouse event |
private void |
logPrint(java.lang.String s)
Write an action to the test log file. |
static void |
main(java.lang.String[] args)
Mainline. |
Methods inherited from class java.awt.Component |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
static java.lang.String version
static java.lang.String copyr
static final int COMMENT
static final int DELAY
static final int MOUSECLICK
static final int MOUSEDBLCLICK
static final int MOUSEMOVE
static final int SETAUTODELAY
static final int SETMODEKEY
static final int TYPEKEY
static final int UNSETMODEKEY
static java.lang.String SET
static java.lang.String UNS
static java.lang.String DM
static java.lang.String MM
int autodelayint
int buttonmask
int keycode
int sleeptime
private static int mouse_x
private static int mouse_y
boolean shiftlock
protected static java.io.PrintStream log
static java.lang.Process thisProc
private int sox
private int soy
private int swidth
private int sheight
boolean verboseMouse
boolean mouseMoveEaten
java.net.DatagramSocket ds
byte[] buf
java.net.DatagramPacket dpckt
java.lang.String lastLogMsg
java.lang.String lastDragMsg
boolean eatingDrags
boolean mouseReleased
int savedMods
java.io.BufferedInputStream processErrors
java.io.BufferedInputStream processOutput
Constructor Detail |
public PGUICapture()
Method Detail |
public static void main(java.lang.String[] args)
String[]
- Runtime arguments:
private void logPrint(java.lang.String s)
String
- Action to write.private void getData()
private void handleKeyEvent(java.lang.String dmsg)
String
- Datagram messageprivate int getKeyCode(java.lang.String dmsg)
String
- Datagram messageprivate void handleMouseEvent(java.lang.String dmsg)
String
- Datagram messageprivate int getMods(java.lang.String dmsg)
String
- Datagram messageprivate int getClickCount(java.lang.String dmsg)
String
- Datagram messageprivate java.awt.Point getPoint(java.lang.String dmsg)
String
- Datagram message
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |