com.togethersoft.testing.testserver.plugin.visualtest
Class TestBase

|
+--com.togethersoft.testing.testserver.plugin.visualtest.ComponentInformer
  |
  +--com.togethersoft.testing.testserver.plugin.visualtest.TestBase

public abstract class TestBase
extends ComponentInformer


Field Summary
 final static intL_MBUTTON
           
 private intlastClickCount
           
 private CategoryLOG
           
 final static intM_MBUTTON
           
 private ITestAssetROmyAsset
           
 private static intmyDelay
           
 private KeyEventmyDummyEvent
           
 private VectormyEvents
           
 private PointmyLastMousePosition
           
 private StringmyLastUUID
           
 private IServerResultListenermyListener
           
 private RobotmyRobot
           
 private longmyStartTime
           
 private static intmyTimeOut
           
 private UIMapmyUIMap
           
 private booleanmyUseRobot
           
 final static intR_MBUTTON
           

Constructor Summary
TestBase(String aName)
           
TestBase()
           

Method Summary
 voidcloseWindow(String UIID)
          Closes window identified by UIID
 voiddelay(int delay)
          Delay for delay milliseconds.Override this method to provide your own synchronization with tested application.
 voideventDispatched(AWTEvent event)
           
 VectorgetEvents()
           
 RobotgetRobot()
           
 protected UIMapgetUIMap()
           
 private voidinitEvents()
           
 private voidinitRobot()
           
 private voidinvokeInDispatch(Runnable runnable)
           
 voidkeyPress(String UIID, int keyCode)
          Press key at the component
 voidkeyRelease(String UIID, int keyCode)
          Releases key on UIID component denoted by keyCode
 voidmouseClick()
          Click mouse at the current mouse cursor position
 voidmouseClick(String UIID, int buttons, int clickCount)
          Click mouse at the current mouse cursor position
 voidmousePress(String UIID, int buttons)
          Press mouse on UIID component
 voidmouseRelease(String UIID, int buttons)
          Release mouse on UIID component
 voidmoveComponent(String id, int x, int y)
          Move component to x,y
 voidmoveMouse(String id, int x, int y)
          Move mouse to x,y inside UIID component
 voidperformAction(String UUID, String actionCommand, int modifiers)
          Posts ActionEvent on UUID component
 private StringreflectKey(int keyCode)
           
 (package private) voidreleaseFuncKeys()
           
 voidresizeComponent(String id, int h, int w)
          Resize component to h,w
 voidscroll(String UIID, int id, int adjType, int units)
          Scrolls the scrollable component like ScrollPane by posting AdjustmentEvent
 voidscrollTo(String UIID, int x, int y)
          Scrolls the scrollable component like ScrollPane by posting AdjustmentEvent
 voidselectItem(String UIID, String item)
          Selects item from JList or JComboBox
 voidselectListItem(String id, int[] indices)
          Selects JList items.
 voidsetAsset(ITestAssetRO asset)
           
 voidsetTestResultListener(IServerResultListener listener)
           
 voidsetUIMap(UIMap map)
           
 voidsetUseRobot(boolean b)
           
 abstract voidtestVisualScript()
           
 voidtype(String id, char theChar)
          Type character in id component
 voidtype(String id, String text)
          Type string in id component
 private voidupdateScroller(UIMap map, String id)
           
 voidwaitComponent(UIMap map, String id)
          Waits for id component to appear

Methods inherited from class com.togethersoft.testing.testserver.plugin.visualtest.ComponentInformer
addMenu, findByName, focusTopWindow, getCaption, getComponentBranch, getMenuPosition, getMenus, getRelativePosition, getTopLevelWindows, isParent, quote, removeMenu, restoreWindow, rootByName, startSession

Field Detail

L_MBUTTON

public final static int L_MBUTTON

lastClickCount

private int lastClickCount

LOG

private Category LOG

M_MBUTTON

public final static int M_MBUTTON

myAsset

private ITestAssetRO myAsset

myDelay

private static int myDelay

myDummyEvent

private KeyEvent myDummyEvent

myEvents

private Vector myEvents

myLastMousePosition

private Point myLastMousePosition

myLastUUID

private String myLastUUID

myListener

private IServerResultListener myListener

myRobot

private Robot myRobot

myStartTime

private long myStartTime

myTimeOut

private static int myTimeOut

myUIMap

private UIMap myUIMap

myUseRobot

private boolean myUseRobot

R_MBUTTON

public final static int R_MBUTTON
Constructor Detail

TestBase

public TestBase(String aName)

TestBase

public TestBase()
Method Detail

closeWindow

public void closeWindow(String UIID)
Closes window identified by UIID
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)

delay

public void delay(int delay)
Delay for delay milliseconds.Override this method to provide your own synchronization with tested application.
Parameters:
delay - delay in milliseconds

eventDispatched

public void eventDispatched(AWTEvent event)

getEvents

public Vector getEvents()

getRobot

public Robot getRobot()

getUIMap

protected UIMap getUIMap()

initEvents

private void initEvents()

initRobot

private void initRobot()

invokeInDispatch

private void invokeInDispatch(Runnable runnable)
throws java.lang.InterruptedException,
java.lang.reflect.InvocationTargetException

keyPress

public void keyPress(String UIID, int keyCode)
Press key at the component
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
keyCode - Key code as defined in java.awt.evet.KeyEvent

Example:

Press enter at button OK

keyPress("OK",KeyEvent.VK_ENTER);

keyRelease

public void keyRelease(String UIID, int keyCode)
Releases key on UIID component denoted by keyCode
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
keyCode - Key code as defined in KeyEvent

mouseClick

public void mouseClick()
Click mouse at the current mouse cursor position

mouseClick

public void mouseClick(String UIID, int buttons, int clickCount)
Click mouse at the current mouse cursor position
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
buttons - Button codes as defined
clickCount - number of clicks accumulated so far

Example:

Perform double click and click on button OK

mouseClick("OK",L_MBUTTON,1);
mouseClick("OK",L_MBUTTON,2); // double click
mouseClick("OK",L_MBUTTON,2); // click

mousePress

public void mousePress(String UIID, int buttons)
Press mouse on UIID component
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
buttons - button code

mouseRelease

public void mouseRelease(String UIID, int buttons)
Release mouse on UIID component
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
buttons - button code

moveComponent

public void moveComponent(String id, int x, int y)
throws InvalidUIStateException
Move component to x,y
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
x,y - point on screen

moveMouse

public void moveMouse(String id, int x, int y)
throws InvalidUIStateException
Move mouse to x,y inside UIID component
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
x,y - point inside UIID component

performAction

public void performAction(String UUID, String actionCommand, int modifiers)
Posts ActionEvent on UUID component
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
actionCommand - Action Command as defined in ActionEvent
modifiers - Modifiers as defined in ActionEvent

reflectKey

private String reflectKey(int keyCode)

releaseFuncKeys

void releaseFuncKeys()

resizeComponent

public void resizeComponent(String id, int h, int w)
throws InvalidUIStateException
Resize component to h,w
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
h,w - height/width of component

scroll

public void scroll(String UIID, int id, int adjType, int units)
Scrolls the scrollable component like ScrollPane by posting AdjustmentEvent
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
id - ID as defined in AdjustmentEvent
adjType - Adjustment type as defined in AdjustmentEvent
units - Units to scroll as defined in AdjustmentEvent

scrollTo

public void scrollTo(String UIID, int x, int y)
Scrolls the scrollable component like ScrollPane by posting AdjustmentEvent
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
x,y - Coordinates inside component to scroll to.

selectItem

public void selectItem(String UIID, String item)
Selects item from JList or JComboBox
Parameters:
UIID - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
item - String value of list item

selectListItem

public void selectListItem(String id, int[] indices)
Selects JList items.
Parameters:
id - UIID of the JList component
indices - indices of items to select

setAsset

public void setAsset(ITestAssetRO asset)

setTestResultListener

public void setTestResultListener(IServerResultListener listener)

setUIMap

public void setUIMap(UIMap map)

setUseRobot

public void setUseRobot(boolean b)

testVisualScript

public abstract void testVisualScript()

type

public void type(String id, char theChar)
Type character in id component
Parameters:
id - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
theChar - Character to type

type

public void type(String id, String text)
Type string in id component
Parameters:
id - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)
text - String to type

updateScroller

private void updateScroller(UIMap map, String id)

waitComponent

public void waitComponent(UIMap map, String id)
Waits for id component to appear
Parameters:
map - User interface map
id - String identifier from Interface Map (can be looked up in inspector, displayed in capital letters)

Association Links

to Class java.awt.event.KeyEvent

to Class com.togethersoft.testing.testserver.plugin.visualtest.UIMap

to Class java.util.Vector

to Class java.awt.Robot

to Class java.awt.Point

to Class java.lang.String

to Class com.togethersoft.testing.testserver.IServerResultListener

to Class com.togethersoft.testing.shared.ITestAssetRO