cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Operators Environment

Any Jemmy operator - subclass of org.netbeans.jemmy.operators.Operator class has its own environment which consists in:
  • Timeouts
  • Output
  • String comparator
  • Component visualizer
  • Verification mode
  • Jemmy properties


  • Operator environment is passed from one operator to another following next two rules:
  • Any operator created by constructor not having another operator as a parameter has default environment values which are taken from current Jemmy properties.
  • Examples:
    new JFrameOperator("My Frame");
    new JDialogOperator("My Modal Dialog");
    new JPopupOperator();
    new JFileChooserOperator();
        
  • Any operator created by constructor having another operator as a parameter copies all environment from that operator by Operator.copyEnvironment(Operator) method.
  • Example:
    new JFrameOperator("My Frame", 0, anotherFrameOperator);
    new JButtonOperator(frameOperator, "Help");
        
    These rules also applicable to environment which is used for a component waiting performed from an operator constructor. If that constructor (other than a constructor with one component parameter, which does not perform waiting) does not have any other operator as a parameter, default environment values are used during waiting. Otherwise environment is taken from operator-parameter.

    Timeouts

    All Jemmy timeout values are kept by org.netbeans.jemmy.Timeouts class. Any class instance might hold any number of timeouts definition. Each timeouts defines by string name typically looking like ClassName.TimeoutName.
    Example: AbstractButtonOperator.PushButtonTimeout, WindowWaiter.WaitWindowTimeout

    Default Timeouts value is taken by operators constructors by org.netbeans.jemmy.JemmyProperties.getCurrentTimeouts() method. Timeouts have values from the table below unless timeout values are specified in a file defined by "jemmy.properties" environment variable.

    Besides current timeout value kept by each Timeouts instance, each timeout also has a default value. If any particular Timeouts instance does not have some timeout defined, its default value is returned.
    Example:
    Timeouts timeouts = JemmyProperties.getCurrentTimeouts();
    System.out.println(timeouts.getTimeout("Definitely.Nonexistent.Timeout"));
    //-1 in output
    Timeouts.setDefault("Definitely.Nonexistent.Timeout", 222);
    System.out.println(timeouts.getTimeout("Definitely.Nonexistent.Timeout"));
    //222
    timeouts.setTimeout("Definitely.Nonexistent.Timeout", 333);
    System.out.println(timeouts.getTimeout("Definitely.Nonexistent.Timeout"));
    //333
        
    Any operator has a set of timeouts which are necessary to get it working. These timeouts default values are declared in correspondent class' static initializer section like this:
    Example (from AbstractButtonOperator):
        static {
    	Timeouts.initDefault("AbstractButtonOperator.PushButtonTimeout", PUSH_BUTTON_TIMEOUT);
        }
        
    Default values for all existing timeouts are in this table:
    Timeout name Timeout description Timeout value
    ActionProducer.MaxActionTime time action should be finished in. 10000
    DialogWaiter.WaitDialogTimeout time to wait dialog displayed 60000
    DialogWaiter.AfterDialogTimeout time to sleep after dialog has been dispayed 0
    EventDispatcher.WaitQueueEmptyTimeout to wait event queue empty. 180000
    EventDispatcher.RobotAutoDelay param for java.awt.Robot.setAutoDelay method. 0
    EventDispatcher.WaitComponentUnderMouseTimeout time to wait component under mouse. 10000
    EventTool.WaitEventTimeout time to wait for AWT events. 60000
    EventTool.WaitNoEventTimeout when checking for the absence of incoming AWT 180000
    EventTool.EventCheckingDelta time delta between checks for AWT events. 10
    FrameWaiter.WaitFrameTimeout time to wait frame displayed. 60000
    FrameWaiter.AfterFrameTimeout time to sleep after frame has been displayed. 0
    QueueTool.WaitQueueEmptyTimeout timeout to wait queue emptied 180000
    QueueTool.QueueCheckingDelta time delta to check result 10
    QueueTool.LockTimeout time to wait queue locked after lock action has been put there 180000
    QueueTool.InvocationTimeout time for action was put into queue to be started 180000
    QueueTool.MaximumLockingTime maximum time to lock queue. 180000
    Test.WholeTestTimeout time for the whole test 3600000
    Waiter.TimeDelta time delta to check actionProduced result. 10
    Waiter.WaitingTime maximal waiting time 60000
    Waiter.AfterWaitingTime time to sleep after waiting has been finished. 0
    WindowWaiter.WaitWindowTimeout time to wait window displayed 60000
    WindowWaiter.AfterWindowTimeout time to sleep after window has been dispayed 0
    AbstractButtonOperator.PushButtonTimeout time between button pressing and releasing 0
    ButtonOperator.PushButtonTimeout time between button pressing and releasing 0
    ComponentOperator.PushKeyTimeout time between key pressing and releasing 0
    ComponentOperator.MouseClickTimeout time between mouse pressing and releasing 0
    ComponentOperator.BeforeDragTimeout time to sleep before grag'n'drop operations 0
    ComponentOperator.AfterDragTimeout time to sleep after grag'n'drop operations 0
    ComponentOperator.WaitComponentTimeout time to wait component displayed 10000
    ComponentOperator.WaitComponentEnabledTimeout time to wait component enabled 1000
    ComponentOperator.WaitStateTimeout 5000
    ComponentOperator.WaitComponentTimeout time to wait container displayed 10000
    JComboBoxOperator.BeforeSelectingTimeout time to sleep after list opened and before item selected 0
    JComboBoxOperator.WaitListTimeout time to wait list opened 1000
    JComponentOperator.WaitToolTipTimeout time to wait tool tip displayed 10000
    JComponentOperator.ShowToolTipTimeout time to show tool tip 0
    JFileChooserOperator.WaitListPaintedTimeout 10000
    JMenuItemOperator.PushMenuTimeout time between button pressing and releasing 0
    JMenuOperator.WaitBeforePopupTimeout time to sleep before popup expanding 0
    JMenuOperator.WaitPopupTimeout time to wait popup displayed 10000
    JMenuOperator.PushMenuTimeout time for the whole menu operation 10000
    JProgressBarOperator.WaitValueTimeout used from waitValue() method 10000
    JScrollBarOperator.OneScrollClickTimeout time for one scroll click 0
    JScrollBarOperator.WholeScrollTimeout time for the whole scrolling 60000
    JScrollBarOperator.BeforeDropTimeout to sleep before drop 0
    JScrollBarOperator.DragAndDropScrollingDelta to sleep before drag steps 0
    JSliderOperator.OneScrollClickTimeout timeout for one scroll click 0
    JSliderOperator.WholeScrollTimeout timeout for the whole scrolling 60000
    JSplitPaneOperator.ScrollClickTimeout time for simple scroll click 0
    JSplitPaneOperator.BetweenClickTimeout time to sleep between scroll clicks 0
    JSplitPaneOperator.WholeScrollTimeout time for the whole scrolling 60000
    JTableOperator.WaitEditingTimeout time to wait cell editing 1000
    JTextComponentOperator.PushKeyTimeout time between key pressing and releasing during text typing 0
    JTextComponentOperator.BetweenKeysTimeout time to sleep between two chars typing 0
    JTextComponentOperator.ChangeCaretPositionTimeout maximum time to chenge caret position 10000
    JTextComponentOperator.TypeTextTimeout maximum time to type text 30000
    JTreeOperator.WaitNodeExpandedTimeout time to wait node expanded 10000
    JTreeOperator.WaitNodeCollapsedTimeout time to wait node collapsed 10000
    JTreeOperator.WaitAfterNodeExpandedTimeout time to to sleep after node expanded 0
    JTreeOperator.WaitNextNodeTimeout time to wait next node displayed 10000
    JTreeOperator.WaitNodeVisibleTimeout time to wait node visible 10000
    JTreeOperator.BeforeEditTimeout time to sleep before edit click 1000
    JTreeOperator.WaitEditingTimeout time to wait node editing 10000
    ScrollbarOperator.OneScrollClickTimeout 0
    ScrollbarOperator.WholeScrollTimeout 60000
    ScrollbarOperator.BeforeDropTimeout 0
    ScrollbarOperator.DragAndDropScrollingDelta 0
    TextAreaOperator.PushKeyTimeout 0
    TextAreaOperator.BetweenKeysTimeout 0
    TextAreaOperator.ChangeCaretPositionTimeout 10000
    TextAreaOperator.TypeTextTimeout 30000
    TextComponentOperator.PushKeyTimeout 0
    TextComponentOperator.BetweenKeysTimeout 0
    TextComponentOperator.ChangeCaretPositionTimeout 10000
    TextComponentOperator.TypeTextTimeout 30000
    TextFieldOperator.PushKeyTimeout 0
    TextFieldOperator.BetweenKeysTimeout 0
    TextFieldOperator.ChangeCaretPositionTimeout 10000
    TextFieldOperator.TypeTextTimeout 30000

    Any class implementing org.netbeans.jemmy.Timeoutable can have its own timeout values. If a component operator created for has subcomponents, the operator tipically creates suboperators for those components itself. I might also create a copy of Timeouts by Timeouts.cloneThis() method and change some timeout values for a suboperator.

    Example (from JScrollBarOperator):
    	minButtOperator = new JButtonOperator(minButt);
    	...
    	minButtOperator.copyEnvironment(this);
    	...
    	Timeouts times = timeouts.cloneThis();
    	times.setTimeout("AbstractButtonOperator.PushButtonTimeout",
    			 times.getTimeout("JScrollBarOperator.OneScrollClickTimeout"));
    	...
    	minButtOperator.setTimeouts(times);		 
        
    Noone from existing operators changes a contents of Timeouts instance passed into setTimeouts(Timeouts) methods, so it's safe to pass existing Timeouts into any operator (which is done by all the operators constructors).

    Output

    Output streams are held by org.netbeans.jemmy.TestOut class instance. Like Timeouts there exists an interface for a classes having own output settings: org.netbeans.jemmy.Outputable

    Default TestOut value is taken by operators constructors by org.netbeans.jemmy.JemmyProperties.getCurrentOutput() method. By default System.out and System.err are used as output streams. If org.netbeans.jemmy.Test.run(*) method is used to execute tests, streams are defined by parameters passed into this method.

    Like with timeouts some operators might create new TestOut instance different from what they have.
    Example (from JScrollBarOperator):
    	minButtOperator = new JButtonOperator(minButt);
    	...
    	minButtOperator.copyEnvironment(this);
    	...
    	minButtOperator.setOutput(output.createErrorOutput());
        

    String Comparator

    Implementation of org.netbeans.jemmy.operators.Operator.StringComparator defines the way to compare component string properties such as text, items, cell text with a pattern. A comparator instance assigned to operator is used for any operators' methods having String parameter and not having another comparator as a parameter. The comparator instance is also used for subcomponent finding (if component is searched by string property) following rules described above.
    Comparator is simple passed from operator to suboperators with no change.

    Comparator used by default is new org.netbeans.jemmy.operators.Operator.DefaultStringComparator(false, false)

    Component Visualizer

    Implementations of org.netbeans.jemmy.operators.Operator.ComponentVisualizer interface is used to prepare component for user input. Default implementation - org.netbeans.jemmy.util.DefaultVisualizer is able to activate window containing component, scroll scrollpanes under the components, switch pages of a tebbed pane, activate internal frame.

    Some operators might create an org.netbeans.jemmy.util.EmptyVisualizer instance for suboperators to avoid unnecessary actions.

    Verification Mode

    Boolean verification property defines if operator should verify/wait for appearing of correct result of operation. For example, verify text typing operation by waiting for typed text to be displayed inside component.

    Jemmy Properties

    Each operator has a pointer to JemmyProperties. This pointer copied from one operator to another like other properties. JemmyProperties assigned to operator used to get driver set.


    Companion
    Projects:
    MySQL Database Server   GlassFish Community: an Open Source Application Server   Open Solaris  Open JDK: an Open SourceJDK   Mobile & Embedded Community     Sponsored by 
    Sponsored by Sun Microsystems