|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PGUIRobot
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 to test the GUI interface of Java programs in the PhOSCo suite.
Inner Class Summary | |
private class |
PGUIRobot.WriteProcessOutput
Class to write an output stream of the tested process to a file. |
Field Summary | |
(package private) int |
autodelayint
Test parameter - auto delay interval |
(package private) byte[] |
bufPGUI
PGUI Capture/Robot 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) java.net.DatagramPacket |
dpcktPGUI
PGUI Capture/Robot Instrumentation Datagram Packet |
(package private) static int |
DRAGMOUSE
Test Code |
(package private) int |
dragStartX
Test parameter - mouse x coordinate at start of drag |
(package private) int |
dragStartY
Test parameter - mouse y coordinate at start of drag |
(package private) java.net.DatagramSocket |
dsPGUI
PGUI Capture/Robot Instrumentation Datagram Socket |
private int |
errcode
Error code |
(package private) static int |
FILECOMPARE
Test Code |
(package private) static int |
FILECOPY
Test Code |
private int |
imageCounter
Image counter |
private java.lang.String |
invocationString
Tested Process Invocation string |
(package private) static int |
INVOKED
Test Code |
(package private) int |
keycode
Test parameter - Key code |
protected static java.io.PrintStream |
log
Log file |
(package private) static int |
MOUSECLICK
Test Code |
(package private) static int |
MOUSEDBLCLICK
Test Code |
(package private) static int |
MOUSEMOVE
Test Code |
private int |
numpasses
Number of passes |
(package private) static int |
PROCESS
Test Code |
(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 |
protected java.awt.Robot |
robbie
The Robot |
(package private) static int |
SCREENCAPTURE
Test Code |
(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 |
private java.io.BufferedReader |
tcs
Test Case suite file |
(package private) static int |
TERMINATE
Test Code |
private int |
testcases
Number of test cases |
private boolean |
testeeActive
Tested Process Active Flag |
private boolean |
testpass
Pass/Fail Flag |
(package private) static java.lang.Process |
thisProc
The tested process |
(package private) static int |
TYPEKEY
Test Code |
(package private) static int |
UNSETMODEKEY
Test Code |
(package private) boolean |
verbose
Verbosity Flag |
(package private) static java.lang.String |
version
Version |
(package private) int |
x
Test parameter - mouse x coordinate |
(package private) int |
y
Test parameter - mouse y coordinate |
Constructor Summary | |
PGUIRobot()
Constructor |
Method Summary | |
private void |
captureScreen(java.lang.String invoc)
Capture and compare Screen Window |
int |
cmdParse(java.lang.String cmdstring)
Parse test command string. |
private void |
fileCompare(java.lang.String invoc)
File Compare |
private void |
fileCopy(java.lang.String invoc)
File Copy |
private java.lang.String |
getTestFilename()
Get next Test Case Filename. |
private void |
logAction(int cmd,
int parm)
Write action message to log file |
private void |
logPrint(java.lang.String s)
Write line in log file |
static void |
main(java.lang.String[] args)
Mainline |
private int |
parseKeyCode(java.lang.String s)
Parse string representation of a key code into the correct KeyEvent value. |
private void |
runProcess(java.lang.String invoc)
Run Process |
private void |
runRobot(java.lang.String invoc)
Invoke application to be tested and get screen window datagram from it. |
private void |
runTests(java.lang.String tfn)
Run GUI Tests from file against current application. |
void |
sendSlave(java.lang.String msg)
Send Datagram Packet to PGUIRobotSlave. |
private void |
writeJPEG(java.awt.image.BufferedImage bi,
java.lang.String filename)
Save an Image to a JPEG file. |
Methods inherited from class java.lang.Object |
|
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 DRAGMOUSE
static final int SETAUTODELAY
static final int SETMODEKEY
static final int TYPEKEY
static final int UNSETMODEKEY
static final int INVOKED
static final int SCREENCAPTURE
static final int PROCESS
static final int FILECOMPARE
static final int FILECOPY
static final int TERMINATE
int autodelayint
int buttonmask
int keycode
int sleeptime
int x
int y
int dragStartX
int dragStartY
boolean shiftlock
protected static java.io.PrintStream log
protected java.awt.Robot robbie
java.net.DatagramSocket dsPGUI
byte[] bufPGUI
java.net.DatagramPacket dpcktPGUI
static java.lang.Process thisProc
private int sox
private int soy
private int swidth
private int sheight
private boolean testeeActive
private java.lang.String invocationString
private java.io.BufferedReader tcs
private int errcode
private boolean testpass
private int testcases
private int numpasses
private int imageCounter
boolean verbose
java.io.BufferedInputStream processErrors
java.io.BufferedInputStream processOutput
Constructor Detail |
public PGUIRobot()
Method Detail |
public static void main(java.lang.String[] args)
String[]
- Runtime arguments:
private void runRobot(java.lang.String invoc)
String
- Invocation string.private java.lang.String getTestFilename()
The Test Case Suite file must be an ASCII file with no empty lines with a test case file name on each line.
private void runTests(java.lang.String tfn)
String
- Test File namepublic int cmdParse(java.lang.String cmdstring)
This routine may also amend the global test parameters.
String
- Test commandprivate int parseKeyCode(java.lang.String s)
The String may be a single character in which case it represents the character which is required (including single digit characters); it may be a numeric string, in which case this is a string representation of the key code itself; or it may be a key name such as "Alt", "Ctrl", and "Shift".
String
- String key codeprivate void logPrint(java.lang.String s)
String
- Line to be writtenprivate void logAction(int cmd, int parm)
int
- Command codeint
- First parameterprivate void captureScreen(java.lang.String invoc)
String
- Invocation stringprivate void fileCompare(java.lang.String invoc)
String
- Invocation stringprivate void fileCopy(java.lang.String invoc)
String
- Invocation stringprivate void runProcess(java.lang.String invoc)
String
- Invocation stringprivate void writeJPEG(java.awt.image.BufferedImage bi, java.lang.String filename)
BufferedImage
- Image to be saved to JPEG fileString
- Pathname to save file underpublic void sendSlave(java.lang.String msg)
String
- Message to send in packet
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |