SyncTester is an extension of TestCase that is useful for testing objects whose method are to be called sequentially, in effect synchronizing methods with potentially asynchronous behavior.
To take advantage of this helper class, you must declare a dataset named "<instance name>_methods", with a root node whose children are the method names to be called synchronously. The method nodes must be named "call", and have at least the "name" attribute defined. If the method needs to be called with arguments, specify them as value of the optional "args" attribute (only one argument is currently supported).
Your specific tests will only run once a method returns. It is possible to provide an inspector method for each of the asynchronous
methods declared; you reference it with the "tester" attribute of a node in the dataset. These inspector methods must be defined
on the SyncTester object. If you dont specify a tester for a method, the default handler named inspect
will be called with the result of the method call as an argument. You should override this method if you want to have a generic
inspector for most or all of your methods.
Generally speaking, you would expect that an event is sent when a method is done. This framework allows you to specify what
event indicates the end of method execution by declaring the "event" attribute. It is assumed that the sender of the event
is the object referenced by the tested_object
attribute, or that the following method accepts a delegate to call on completion, as the last argument. If neither of these
assumptions is correct, the flow of method execution will break.
For example, if you have an instance of this class named "userinfo", then your list of methods might be declared like this:
<dataset name="userinfo_methods"> <suite> <call name="isAuthenticated" args="admin"/> <call name="getExpiration" event="ondata"/> <call name="createAccount" event="onload" tester="checkAcct"/> </suite> </dataset>
Name (CSS property) | Type (tag) | Type (js) | Default | Category |
---|---|---|---|---|
current_method
|
expression | any | cur_meth.xpathQuery('@name') | readonly |
Helps keep track of currently executed method | ||||
del
|
expression | any | read/write | |
tested_object
|
expression | any | read/write | |
Refers to object to be tested; this is dependent on specific test run |
aaactive, aadescription, aaname, aasilent, aatabindex, align, backgroundrepeat, bgcolor, cachebitmap, capabilities, clickable, clickregion, clip, colortransform, context, contextmenu, cornerradius, cursor, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hasdirectionallayout, hassetheight, hassetwidth, height, layout, loadratio, mask, opacity, pixellock, playing, proxyurl, resource, resourceheight, resourcewidth, rotation, shadowangle, shadowblurradius, shadowcolor, shadowdistance, showhandcursor, source, stretches, subviews, tintcolor, totalframes, unstretchedheight, unstretchedwidth, usegetbounds, valign, visibility, visible, width, x, xoffset, xscale, y, yoffset, yscale
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
assertEquals, assertFalse, assertNotNull, assertNotSame, assertNotUndefined, assertNull, assertSame, assertTrue, assertUndefined, assertWithin, displayMessage, error, fail
bringToFront, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getCurrentTime, getDepthList, getDisplayObject, getID3, getMouse, getNextSelection, getPan, getPrevSelection, getProxyURL, getTotalTime, getVolume, init, isBehind, isInFrontOf, isMouseOver, measureHeight, measureWidth, play, proxyurl, searchSubviews, seek, sendAAEvent, sendBehind, sendInFrontOf, sendToBack, setAccessible, setAttributeRelative, setColor, setColorTransform, setPan, setProxyPolicy, setSource, setVolume, shouldYieldFocus, stop, unload, updateResourceSize
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
Events
onaddsubview, onbackgroundrepeat, onblur, onclick, onclickable, onclip, oncontext, oncornerradius, ondblclick, onerror, onfocus, onframe, onframesloadratio, ongesture, onheight, onkeydown, onkeyup, onlastframe, onload, onloadratio, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmousetrackout, onmousetrackover, onmousetrackup, onmouseup, onmouseupoutside, onopacity, onplay, onplaying, onremovesubview, onshadowangle, onshadowblurradius, onshadowcolor, onshadowdistance, onstop, ontimeout, ontouch, onvisible, onwidth, onx, ony
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.