[previous] [up] [next]     [contents] [index]
Next: An example Up: Overview Previous: Preferences

Test engine

MrEd provides several new primitive functions that simulate user actions, which may be used to test applications. Each primitive name is prefixed by mred:test:. You use these primitives and combine them just as regular MzScheme functions. For example,

  (begin
    (mred:test:keystroke #\A)
    (mred:test:menu-select "File" "Save"))
sends a keystroke event to the window with the keyboard focus and invokes the callback function for the ``Save'' menu item from the ``File'' menu. This has the same effect as if the user typed the key ``A'', pulled down the ``File'' menu and selected ``Save''.

Currently, the test engine has primitives for pushing buttons, setting check-boxes and choices, sending keystrokes, selecting menu items and clicking the mouse. Many functions that are also useful in application testing, such as traversing a tree of panels, getting the text from a canvas, determining if a window is shown, and so on, exist in MrEd.





PLT