Studio:AutoScript: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
 
(258 intermediate revisions by 5 users not shown)
Line 3: Line 3:
= Introduction   =
= Introduction   =


Ascript is the definitive hierarchy of methods, objects, and properties provided by Autosense. While Autosense helps the user find the script methods/data desired in a script, Ascript is the definitive source of what is available from STRIDE when using Autosense.
AutoScript (AScript) is a COM Automation API that provides functionality allowing host-based scripts to interact with target-based binaries through the [[Runtime_Reference|STRIDE Runtime]]. Through AScript, you can:  
 
The ascript object provides functionality that allows host-based scripts to interact with target-based binaries through the STRIDE Runtime. Through ascript, you can:  


*call target-based functions and messages (synchronously or asynchronously)  
*call target-based functions and messages (synchronously or asynchronously)  
*set and read parameter values orf these functions and messages  
*set and read parameter values of these functions and messages  
*transparently emulate (mock) target-based functions
*transparently emulate (mock) target-based functions


= Automation API  =
= AutoScript Automation Usage =
 
In scripts run inside [[STRIDE Studio]] AScript could be accessed through a auto-injected system object called '''ascript'''. When creating a script, the user is provided with in-place Autosense (see below) that helps the user to find the script methods/data desired.


== Ascript  ==
[[Image:Ascriptpopup.jpg]]


When creating a script, the user types in Ascript followed by dot '.' to get Autosense to display. The user may select methods to be used within his script. The user may access property data within his script. this API is the definitive API for Autosense. The following table outlines the main objects and collections available to the user.  
= Ascript API =
The '''ascript''' object is the top-most object when accessing methods and properties related to Ascript. The following table describes what is available from the '''ascript''' object. Other nested properties and methods may be found in the folowing sections.


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 23: Line 24:
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| [[#Ascript.Arguments|Arguments]]  
| [[#ascript.Arguments|Arguments]]  
| Collection  
| Collection  
| Collection of arguments.
| Collection of arguments.
|-
|-
| [[#Ascript.Constants|Constants]]  
| [[#ascript.Constants|Constants]]  
| Collection  
| Collection  
| Collection of constants.
| Collection of constants.
|-
|-
| [[#Ascript.Database|Database]]  
| [[#ascript.Database|Database]]  
| valign="top" align="left" width="150" | Object&nbsp;  
| valign="top" align="left" width="150" | Object&nbsp;  
| Database settings.
| Database settings.
|-
|-
| [[Ascript.Functions|Functions]]  
| [[#ascript.Functions|Functions]]  
| Collection  
| Collection  
| Collection of functions.
| Collection of functions.
|-
|-
| void '''Initialize (''' <br>&nbsp;&nbsp; String STIDName, <br>&nbsp;&nbsp; String databaseFile, <br>&nbsp;&nbsp; Integer&nbsp;messageBoxTimeout [optional] <br>''')'''  
| void '''Initialize (''' <br>&nbsp;&nbsp; String STIDName, <br>&nbsp;&nbsp; String databaseFile, <br>&nbsp;&nbsp; int&nbsp;MessageBoxTimeout [optional] <br>''')'''  
| Method  
| Method  
| Initializes and ascript object instance that has been created outside of tghe STRIDE Studio environment. This call is needed only on an explicitly-created ascript instance. This call should not be made on an ascript instance automatically created and injected into a script by STRIDE Studio.
| Initializes and ascript object instance that has been created outside of the STRIDE Studio environment. This call is needed only on an explicitly-created ascript instance. This call should not be made on an ascript instance automatically created and injected into a script by STRIDE Studio.
|-
|-
| IsEventPending  
| IsEventPending  
| Property, <br>'''Read-only''',<br>bool
| Property, <br>'''Read-only''',<br>boolean
| Contains true if there is at least one event in this script's message queue. Events are retrieved from the queue using ascript.WaitForEvent();
| Contains true if there is at least one event in this script's message queue. Events are retrieved from the queue using the [[AutoScript_Events#WaitForEvent|WaitForEvent]] method (ascript.WaitForEvent()).
|-
|-
| LogicalPath  
| LogicalPath  
Line 51: Line 52:
| Contains the script's path in the STRIDE Studio workspace tree.
| Contains the script's path in the STRIDE Studio workspace tree.
|-
|-
| void '''MessageBox('''&nbsp;<br>&nbsp;&nbsp; String message, <br>&nbsp;&nbsp; String title&nbsp;[optional],&nbsp;<br>&nbsp;&nbsp; String type <br>''')'''  
| String '''MessageBox('''&nbsp;<br>&nbsp;&nbsp; String Message, <br>&nbsp;&nbsp; String Title&nbsp;[optional],&nbsp;<br>&nbsp;&nbsp; String Type <br>''')'''  
| Method  
| Method  
| Displays a model message box dialog.
| Displays a model message box dialog.  
<br>
Acceptable strings for type include:
* "OK"
* "OKCANCEL"
* "RETRYCANCEL"
* "YESNO"
* "YESNOCANCEL"
<br>
Returns a string indicating the action used to dismiss the message box. Strings returned include:
* "ABORT"
* "CANCEL"
* "IGNORE"
* "YES"
* "NO"
* "OK"
|-
|-
| [[Ascript.Messages|Messages]]  
| [[#ascript.Messages|Messages]]  
| Collection  
| Collection  
| Collection of messages.
| Collection of messages.
|-
|-
| Output  
| Output  
| Property, <br>(String, integer, or object)  
| Property, <br>(String, Integer, or Object)  
| This is the return value from a RunBlocking() call that invoked this script. This works only when the script is invoked using RunBlocking() in the studio object model.
| This is the return value from a RunBlocking() call that invoked this script. This works only when the script is invoked using RunBlocking() in the studio object model.
|-
|-
| RspTimeoutPeriod  
| RspTimeoutPeriod  
| Property, <br>Integer
| Property, <br>int
| This is the timeout threshold for synchronous function and message calls (in milliseconds). A zero value indicates no timeout.
| This value controls the timeout threshold for test unit run, synchronous function call and two-way message send (in milliseconds). A zero value indicates no timeout. For interactively run scripts the timeout behavior may be different. Specific calls affected by this value are:
* [[#ascript.TestUnits.Item|Run]]
* [[#ascript.Functions.Item.User|Call]]
* [[#ascript.Functions.Item.User|CallBypassOverride]]
* [[#ascript.Messages.Item.User|SendAndRead]]
* [[#ascript.Messages.Item.User|SendAndReadBypassOverride]]
|-
|-
| ScriptName  
| ScriptName  
Line 71: Line 92:
| Contains the&nbsp;name of the currently&nbsp;running&nbsp;script with extension and without path. If the current ascript instance was instantiated and initialized outside of STRIDE Studio, this value will reflect the STIDName passed to ascript.Initialize().
| Contains the&nbsp;name of the currently&nbsp;running&nbsp;script with extension and without path. If the current ascript instance was instantiated and initialized outside of STRIDE Studio, this value will reflect the STIDName passed to ascript.Initialize().
|-
|-
| void '''Sleep('''<br>&nbsp;&nbsp; Integer period<br>''')'''  
| void '''Sleep('''<br>&nbsp;&nbsp; int Period<br>''')'''  
| Method  
| Method  
| Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours).
| Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours).
|-
|-
| [[#Ascript.TestUnits|Test Units]]  
| [[Reporter#reporter.Suites.Item|TestSuite]]
| Property,<br>Object
| An object of type Reporter's [[Reporter#reporter.Suites.Item|Suite]]. By default it is set to the associated with the script testSuite object but can be overriden by the user as needed.
|-
| [[#ascript.TestUnits|TestUnits]]  
| Collection  
| Collection  
| Collection of test units.
| Collection of test units.
|-
|-
| [[#Ascript.Timers|Timers]]  
| [[#ascript.Timers|Timers]]  
| Collection  
| Collection  
| Collection of timers.
| Collection of timers.
|-
|-
| Object '''WaitForEvent ( '''void ''')'''  
| [[AutoScript_Events#WaitForEvent|Event]] '''WaitForEvent ( void )'''  
| Method  
| Method  
| Pauses script execution until an event is detected in this script's event queue.
| Pauses script execution until an event is detected in this script's event queue. See [[AutoScript_Events#WaitForEvent|WaitForEvent]] for more information on this method.
|-
|-
| WaitTimeoutPeriod  
| WaitTimeoutPeriod  
Line 94: Line 119:
<br>
<br>


=== Ascript.Arguments<br> ===
== ascript.Arguments<br> ==


The Arguments collection represents the arguments passed to a script which has been invoked via one of the following methods of the Studio Object Model's File object:
The Arguments collection manages a list of [[#ascript.Arguments.Item|Arguments]] passed to a script which has been invoked via one of the following methods of the [[STRIDE_Studio|Studio]] Object Model's File object:
<br>
* RunBlocking([arg1], [arg2], ...)
* RunBlocking([arg1], [arg2], ...)
* RunNonBlocking([arg1], [arg2], ...)
* RunNonBlocking([arg1], [arg2], ...)
<br>
The default sort order of the member argument objects is the order in which the arguments were given in the call where the script was invoked.
The default sort order of the member argument objects is the order in which the arguments were given in the call where the script was invoked.


Line 108: Line 135:
|-
|-
| valign="top" | Count
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>Integer
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Arguments in this collection.<br>
| valign="top" | Returns the number of Arguments in this collection.<br>
|-
|-
| valign="top" align="left" width="150" |  
| valign="top" align="left" width="150" |  
[[#Ascript.Arguments.Item|object]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; Integer index<br>''')'''
[[#ascript.Arguments.Item|Argument]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; int Index<br>''')'''


| valign="top" | Method<br>
| valign="top" | Method<br>
Line 118: Line 145:
|-
|-
| valign="top" align="left" width="150" |  
| valign="top" align="left" width="150" |  
[[#Ascript.Arguments.Item|object]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; String name<br>''')'''
[[#ascript.Arguments.Item|Argument]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; String Name<br>''')'''


| valign="top" | Method<br>
| valign="top" | Method<br>
Line 126: Line 153:
|}
|}


==== <br>Ascript.Arguments.Item<br> ====
=== <br>ascript.Arguments.Item<br> ===


An individual argument is accessed from the collection using the item(#) interface.  
The ascript [[#ascript.Arguments|Arguments]] Collection's Item() method returns an Argument Object.  


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 151: Line 178:
<br>
<br>


=== Ascript.Constants<br> ===
== ascript.Constants<br> ==


Constants is a collection of constants contained and managed through Ascript.  
The Constants collection contains [[#ascript.Constants.Item|Constants]] objects that represent all constants in C/C++ source code compiled by the STRIDE compiler. Constants include all #define symbols and enumerated constants.  


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 166: Line 193:
|-
|-
| valign="top" | Count
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>Integer
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Constants in this collection.<br>
| valign="top" | Returns the number of Constants in this collection.<br>
|-
|-
| valign="top" align="left" width="150" |  
| valign="top" align="left" width="150" |  
[[#Ascript.Constants.Item|object]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; Integer index<br>''')'''
[[#ascript.Constants.Item|Constant]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; int Index<br>''')'''


| valign="top" | Method<br>
| valign="top" | Method<br>
Line 176: Line 203:
|-
|-
| valign="top" align="left" width="150" |  
| valign="top" align="left" width="150" |  
[[#Ascript.Constants.Item|object]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; String name<br>''')'''
[[#ascript.Constants.Item|Constant]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; String Name<br>''')'''


| valign="top" | Method<br>
| valign="top" | Method<br>
Line 186: Line 213:
<br>
<br>


==== <br>Ascript.Constants.Item<br> ====
=== <br>ascript.Constants.Item<br> ===


An individual constant is accessed from the collection using the item(#) interface.  
The ascript [[#ascript.Constants|Constants]] Collection's Item() method returns a Constant object.  


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 196: Line 223:
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| valign="top" align="left" width="150" | Value&nbsp;
| valign="top" align="left" width="150" | Name
| valign="top" align="left" | Property,<br>'''Read-only''', <br>String  
| valign="top" align="left" | Property,<br>'''Read-only''', <br>String  
| valign="top" align="left" | The name of the constant.
|-
| valign="top" align="left" width="150" | Value
| valign="top" align="left" | Property,<br>'''Read-only''', <br>String
| valign="top" align="left" | The value of the constant.
| valign="top" align="left" | The value of the constant.
|}
|}
Line 203: Line 234:
<br>
<br>


=== <br>Ascript.Database  ===
== <br>ascript.Database  ==


Database is an object containing properties related to the database managed by Ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example:  
The Database object represents the currently-loaded STRIDE database managed by ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example:  


var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name;  
var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name;  
Line 226: Line 257:
<br>
<br>


=== Ascript.Functions  ===
== ascript.Functions ==
 
The Functions collection represents all captured [[#ascript.Functions.Item|Function]] interfaces in the active database.
 
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
| width="150" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | Method
| valign="top" | Sorts the Functions collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Functions should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values.
|-
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Functions in this collection.<br>
|-
| valign="top" align="left" width="150" |
[[#ascript.Functions.Item|Function]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;&nbsp; int Index<br>''')'''
| valign="top" | Method<br>
| valign="top" | Retrieves the function at the given index. An exception is thrown if the index is out of range.<br>
|-
| valign="top" align="left" width="150" |
[[#ascript.Functions.Item|Function]]&nbsp;'''Item''' (<br>&nbsp;&nbsp;String Name<br>''')'''
| valign="top" | Method<br>
| valign="top" | Retrieves the function with the given name. A null value is returned if there is no function with the given name.<br>
|}
 
<br>
 
=== ascript.Functions.Item ===


Accessing Ascript.Functions properties requires getting ahold of an actual function object. Ascript.Functions is actually a collection. Accessing a single function is performed via ascript.Functions.Item.[property]. Below is a table of function attributes that may be retrieved:
The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the [[#ascript.Functions|Functions]] collection.


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 237: Line 299:
|-
|-
| Name  
| Name  
| Property,<br>'''Read-only''',<br>bool
| Property,<br>'''Read-only''',<br>boolean
| Function's name.
| Function's name.
|-
|-
| [[#Ascript.Functions.Item.Owner|Owner]]  
| [[#ascript.Functions.Item.Owner|Owner]]  
| Property,<br>'''Read-only''',<br>Object  
| Property,<br>'''Read-only''',<br>Object  
| Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function.
| Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function.
|-
|-
| SUID  
| SUID  
| Property,<br>'''Read-Only''',<br>integer
| Property,<br>'''Read-Only''',<br>int
| STRIDE Unique IDentifier assigned by compiler.
| STRIDE Unique IDentifier assigned by compiler.
|-
|-
Line 252: Line 314:
| Contains the string "Function".
| Contains the string "Function".
|-
|-
| [[#Ascript.Functions.Item.User|User]]  
| [[#ascript.Functions.Item.User|User]]  
| Property<br>'''Read-Only''',<br>Object  
| Property<br>'''Read-Only''',<br>Object  
| Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function.
| Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function.
Line 259: Line 321:
<br>
<br>


==== Ascript.Functions.Item.Owner  ====
==== ascript.Functions.Item.Owner  ====
The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a [[#ascript.Functions.Item|Function]] object's owner property.


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="140" bgcolor="#66ff99" | '''Member'''<br>
| width="200" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| IsOverrideRegistered  
| IsOverrideRegistered  
| Property,<br>'''Read-Only''',<br>bool
| Property,<br>'''Read-Only''',<br>boolean
| Contains true if owner function override is registered.
| Contains true if there is a registered override owner. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| IsRegistered  
| IsRegistered  
| Property,<br>'''Read-only''',<br>bool
| Property,<br>'''Read-only''',<br>boolean
| Contains true if owner function is registered.
| Contains true if there is a registered owner, a registered override owner, or both. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| Name  
| Name  
| Property,<br>'''Read-only''',<br>bool
| Property,<br>'''Read-only''',<br>String
| Owner name.
| Owner name.
|-
|-
| OutPointers  
| [[AutoScript_Functions#OutPointers|OutPointers]]
| Property,<br>'''Read-only''',<br>?
| Property,<br>'''Read-only''',<br>Object
| TBD.
| Contains the [[AutoScript_Functions#OutPointers|OutPointers]] payload of the Function User object. See [[AutoScript_Functions#Function Payloads|Function Payloads]] for more information.
|-
|-
| ParameterList  
| [[AutoScript_Functions#ParameterList|ParameterList]]
| Property,<br>'''Read-only''',<br>Integer
| Property,<br>'''Read-only''',<br>Object
| STRIDE Unique IDentifier assigned by compiler.
| Contains the object representing the [[AutoScript_Functions#ParameterList|ParameterList]] payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]]. See [[AutoScript_Functions#Function Payloads|Function Payloads]] for more information.
|-
|-
| HRESULT'''&nbsp;Register (void)'''  
| '''void Register ()'''  
| Method  
| Method  
| Registers owner.
| Registers the script from which it is called as the active owner of the function. If there is a currently registered owner or another registration failure, an exception is thrown. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.  
|-
|-
| '''HRESULT RegisterOverride (void)'''  
| '''void RegisterOverride ()'''  
| Method  
| Method  
| Registers owner override.
| Registers the script as the override registered owner. If the function already has an override registered owner or if there is another registration error, an exception is thrown. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| HRESULT '''Return (''' <br>&nbsp;&nbsp; bool* result <br>''')'''  
| '''void Return ()'''  
| Method  
| Method  
| TBD.
| Causes a return from a function call made from another script. See [[AutoScript_Functions#Returns|Return]] for more information. The values of OutPointers and ReturnValue will be reflected to the caller (as long as they are consistent with the input values).
|-
|-
| ReturnValue  
| [[AutoScript_Functions#ReturnValue|ReturnValue]] 
| Property,<br>'''Read-only''',<br>Integer  
| Property,<br>'''Read-only''',<br>Integer  
| STRIDE Unique IDentifier assigned by compiler.
| Contains the object representing the [[AutoScript_Functions#ReturnValue|ReturnValue]] payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]]. See [[AutoScript_Functions#Function Payloads|Function Payloads]] for more information.
|-
|-
| SUID  
| SUID  
| Property,<br>'''Read-only''',<br>Integer
| Property,<br>'''Read-only''',<br>int
| STRIDE Unique IDentifier assigned by compiler.
| STRIDE-unique identifier assigned by compiler.
|-
|-
| Type  
| Type  
| Property,<br>'''Read-only''',<br>String  
| Property,<br>'''Read-only''',<br>String  
| Contains "Function".
| Contains "FunctionOwner". This property is typically used to classify an object that is returned from WaitForEvent.  
|-
|-
| HRESULT'''&nbsp;Unregister (void)'''  
| '''void Unregister ()'''  
| Method  
| Method  
| Function's user object.
| Unregisters the script that was registered as the owner of the function from a prior Register call. If the current script is not the owner or if unregistration fails, an exception is thrown. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| HRESULT'''&nbsp;UnregisterOverride (void)'''  
| '''void UnregisterOverride ()'''  
| Method  
| Method  
| Function's user object.
| Unregisters the script that was registered as the override owner of the function from a prior RegisterOverride call. If the current script is not the registered override owner or if unregistration fails, an exception is thrown. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|}
|}


<br>
<br>


==== Ascript.Functions.Item.User  ====
==== ascript.Functions.Item.User  ====
 
The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a [[#ascript.Functions.Item|Function]] object's User property.
{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="140" bgcolor="#66ff99" | '''Member'''<br>
| width="280" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| width="90" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| HRESULT'''&nbsp;Call (void)'''  
| '''void Call ()'''  
| Method  
| Method  
| TBD.
| Synchronously calls the registered owner of the function (Blocking call). See [[AutoScript_Functions#Synchronous Calls (blocking)|Synchronous Calls]] for more information.
|-
|-
| HRESULT'''CallBypassOverride (void)'''  
| '''void CallBypassOverride ()'''  
| Method  
| Method  
| TBD.
| Synchronously calls the registered owner bypassing the registered override owner of the function (Blocking call). See [[AutoScript_Functions#Synchronous Calls (blocking)|Synchronous Calls]] for more information.
|-
|-
| HRESULT'''CallBypassOverrideNonBlocking (void)'''  
| '''void CallBypassOverrideNonBlocking ()'''  
| Method  
| Method  
| TBD.
| Asynchronously calls the registered owner bypassing the registered override owner of the function (Non-blocking call). See [[AutoScript_Functions#Asynchronous Calls (non-blocking)|Asynchronous Calls]] for more information.
|-
|-
| HRESULT'''CallNonBlocking (void)'''  
| '''void CallNonBlocking ()'''  
| Method  
| Method  
| TBD.
| Asynchronously calls the registered owner of the function (Non-blocking call). See [[AutoScript_Functions#Asynchronous Calls (non-blocking)|Asynchronous Calls]] for more information.
|-
|-
| IsOverrideRegistered  
| IsOverrideRegistered  
| Property,<br>'''Read-only''',<br>bool
| Property,<br>'''Read-only''',<br>boolean
| Contains true if user override is registered.
| Contains true if there is a registered override owner. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| IsRegistered  
| IsRegistered  
| Property,<br>'''Read-only''',<br>bool
| Property,<br>'''Read-only''',<br>boolean
| Contains true if user is registered.
| Contains true if there is a registered owner, a registered override owner, or both. See [[AutoScript_Functions#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| Name  
| Name  
| Property,<br>'''Read-only''',<br>bool
| Property,<br>'''Read-only''',<br>String
| User function name.
| User function name.
|-
|-
| OutPointers  
| [[AutoScript_Functions#OutPointers|OutPointers]]
| Property,<br>'''Read-only''',<br>?
| Property,<br>'''Read-only''',<br>Object
| TBD.
| Contains the [[AutoScript_Functions#OutPointers|OutPointers]] payload of the Function User object. See [[AutoScript_Functions#Function Payloads|Function Payloads]] for more information.
|-
|-
| ParameterList  
| [[AutoScript_Functions#ParameterList|ParameterList]]
| Property,<br>'Read-only''',<br>integer'''
| Property,<br>'''Read-only''',<br>Object
| STRIDE Unique IDentifier assigned by compiler.
| Contains the object representing the [[AutoScript_Functions#ParameterList|ParameterList]] payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]]. See [[AutoScript_Functions#Function Payloads|Function Payloads]] for more information.
|-
|-
| ReturnValue  
| [[AutoScript_Functions#ReturnValue|ReturnValue]]
| Property,<br>'''Read-only''',<br>integer
| Property,<br>'''Read-only''',<br>Object
| STRIDE Unique IDentifier assigned by compiler.
| Contains the object representing the [[AutoScript_Functions#ReturnValue|ReturnValue]] payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]]. See [[AutoScript_Functions#Function Payloads|Function Payloads]] for more information.
|-
|-
| SUID  
| SUID  
| Property,<br>'''Read-only''',<br>,integer
| Property,<br>'''Read-only''',<br>,int
| STRIDE Unique IDentifier assigned by compiler.
| STRIDE-unique identifier assigned by compiler.
|-
|-
| Type  
| Type  
| Property,<br>'''Read-only''',<br>String  
| Property,<br>'''Read-only''',<br>String  
| Contains "Function".
| Contains "FunctionUser". This property is typically used to classify an object that is returned from [[AutoScript_Events#WaitForEvent|WaitForEvent]].
|}
|}


<br>
<br>


=== <br>Ascript.Messages<br> ===
== <br>ascript.Messages<br> ==


Messages is a collection of messages contained and managed through Ascript.  
The Messages Collection is a collection of captured [[#ascript.Messages.Item|Message]] objects. <br>


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 390: Line 453:
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | Method
| valign="top" | Sorts the Messages collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may one of the following: "Name", "SUID", or "Type". The default sorting order is by "Name". This represents how Timers should be sorted in the collection. A runtime exception is thrown if an invalid value is passed<br><br>The 'Order' parameter may be either "Ascending" or "Descending" and is not case sensitive. If not specified, the default is "Ascending". A runtime exception is thrown if a invalid value is passed.
|-
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Messages in this collection.<br>
|-
|-
| valign="top" align="left" width="150" |  
| valign="top" align="left" width="150" |  
[[#Ascript.Messages.Item|object]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; integer index<br>)
[[#ascript.Messages.Item|Message]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; int Index<br>)


| valign="top" | Method<br>
| valign="top" | Method<br>
| valign="top" | Retrieves the message at the given index.<br>
| valign="top" | Retrieves the message at the given index.<br>
|-
| valign="top" align="left" width="150" |
[[#ascript.Messages.Item|Message]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; String Name<br>)
| valign="top" | Method<br>
| valign="top" | Retrieves the message with the given name.<br>
|}
|}


<br>
<br>


==== <br>Ascript.Messages.Item<br> ====
=== <br>ascript.Messages.Item<br> ===


The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the [[#ascript.Messages|Messages]] collection.
{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="150" bgcolor="#66ff99" | '''Member'''<br>
| width="120" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| [[#Ascript.Messages.Item.Owner|Owner]]  
| Name
| Property,<br>'''Read-only''',<br>String
| Message name.
|-
| [[#ascript.Messages.Item.Owner|Owner]]  
| Property,<br>'''Read-only''',<br>Object  
| Property,<br>'''Read-only''',<br>Object  
| Message's owner object.
| Message's owner object.
|-
|-
| SMID
| SUID
| Property,<br>'''Read-only''',<br>integer
| Property,<br>'''Read-only''',<br>int
| STRIDE Message IDentifier assigned by compiler.
| STRIDE Unique Identifier assigned by compiler.
|-
|-
| SUID
| Type
| Property,<br>'''Read-only''',<br>integer
| Property,<br>'''Read-only''',<br>String
| STRIDE Unique IDentifier assigned by compiler.
| Contains message type defined by the SCL declaration. Legal values include:
* "OneWayMessage"
* "OneWayResponse"
* "TwoWayMessage"
* "BroadcastMessage"
|-
|-
| [[#Ascript.Messages.Item.User|User]]  
| [[#ascript.Messages.Item.User|User]]  
| Property,<br>'''Read-only''',<br>Object  
| Property,<br>'''Read-only''',<br>Object  
| Message's user object.
| Message's user object.
Line 427: Line 513:
<br>
<br>


===== Ascript.Messages.Item.Owner<br> =====
==== ascript.Messages.Item.Owner<br> ====


The Message Owner object represents the Owner-side of a [[#ascript.Messages.Item|Message]]. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.<br>
This object allows access to the message destination. The message can be routed to any of the following:
<br>
* the original on-target receiver
* a window in STRIDE Studio
* a script running in Studio
<br>
{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="150" bgcolor="#66ff99" | '''Member'''<br>
| width="210" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| width="80" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| HRESULT'''&nbsp;Broadcast (void)'''  
| '''void Broadcast ()'''  
| Method  
| Method  
| Broadcast method.
| Broadcast method exists only for Broadcast Messages. This method broadcasts this message to all message users that have subscribed to this message. The Response payload values are marshaled to all subscribed message users. See [[AutoScript_Messages#Broadcast Messaging|Broadcast Messaging]] for more information.
|-
| [[AutoScript_Dynamic_Objects|Command]]
| Property,<br>'''Read-only''',<br>Object
| This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]] representing the Command payload of the Message Owner. The property exists only if the captured message took one or more parameters. The property contains all the values of the Message User Command fields at the time that the message User called the Owner. See [[AutoScript_Messages#Message Payloads|Message Payloads]] for more information.
|-
| IsOverrideRegistered
| Property,<br>'''Read-only''',<br>boolean
| Contains the override Owner registration state of the message. True only if there is a registered override owner. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| IsRegistered
| Property,<br>'''Read-only''',<br>boolean
| Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| Name
| Property,<br>'''Read-only''',<br>String
| Contains Message name.
|-
|-
| HRESULT '''Register (void)'''  
| '''void Register ()'''  
| Method  
| Method  
| Register method.
| This method only exists for One-Way Command or Two-Way Messages. The calling script is registered as the active owner of the message. If there is already a registered owner or if there is some other registration failure, an exception is thrown. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| HRESULT '''RegisterOverride (void)'''  
| '''void RegisterOverride ()'''  
| Method  
| Method  
| Register override method.
| This method only for One-Way Command or Two-Way Messages. The calling script is registered as the registered override owner (such that all future messages are routed to this owner over and above the registered owner). If there is already an override owner or if there is another registration failure, an exception is thrown. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| [[AutoScript_Dynamic_Objects|Response]]
| Property,<br>'''Read-only''',<br>Object
| This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]] representing the Response payload of the Message Owner. The property exists only if the message is defined with a response payload. See [[AutoScript_Messages#Message Payloads|Message Payloads]] for more information.
|-
|-
| HRESULT '''SendRsp (void)'''  
| '''void SendRsp ()'''  
| Method  
| Method  
| Send response method.
| Send response method exists only for One-Way Response or Two-Way Messages. The method sends the message as a response to a prior message command from a message user. If there is not pending message response expected an exception is thrown. After setting values of the response payload, a script that implements an Owner message calls SendRsp() to reply to an earlier two-way message (or one-way response). The effect of this call on the calling (User) script depends on how the earlier user message was sent. See [[AutoScript_Messages#Point-to-Point Messaging|Point-to-Point Messaging]] for more information.
|-
| SUID
| Property,<br>'''Read-only''',<br>int
| STRIDE Unique Identifier assigned by compiler.
|-
| Type
| Property,<br>'''Read-only''',<br>String
| Contains message type defined by the SCL declaration. Legal values include:
* "OneWayMessage"
* "OneWayResponse"
* "TwoWayMessage"
* "BroadcastMessage"
|-
|-
| HRESULT '''Unregister (void)'''  
| '''void Unregister ()'''  
| Method  
| Method  
| Unregister method.
| This method only exists for One-Way Command or Two-Way Messages. This method unregisters the current script as the owner of the message. If the current script is not the registered owner or if unregistration fails, an exception is thrown. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
|-
| HRESULT '''UnregisterOverride (void)'''  
| '''void UnregisterOverride ()'''  
| Method  
| Method  
| Unregister override method.
| This method exists only for One-Way Command or Two-Way Messages. This method unregisters the current script as registered override owner. If the current script is not the registered override owner or if registration fails, an exception is thrown. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|}
|}


<br>
<br>


===== Ascript.Messages.Item.User<br> =====
==== ascript.Messages.Item.User<br> ====
The Message User object represents the User-side of a [[#ascript.Messages.Item|Message]]. This may be a sender of a one-way or two-way message. It may also be the receiver of a broadcast message. The User object may be used to send a message from a script to the registered message owner through the STRIDE Runtime.<br>


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
|-
|-
| width="150" bgcolor="#66ff99" | '''Member'''<br>
| width="240" bgcolor="#66ff99" | '''Member'''<br>
| width="100" bgcolor="#66ff99" | '''Type'''<br>
| width="90" bgcolor="#66ff99" | '''Type'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| HRESULT'''&nbsp;SendAndRead (bool* value)'''  
| [[AutoScript_Dynamic_Objects|Command]] 
| Property,<br>'''Read-only''',<br>Object
| This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]] representing the Command payload of the Message User. The property exists only if the captured message took one or more parameters. The values of all Message User Command payload fields should be set before the Message Owner is called. See [[AutoScript_Messages#Message Payloads|Message Payloads]] for more information.
|-
| IsOverrideRegistered
| Property,<br>'''Read-only''',<br>boolean
| Contains the override Owner registration state of the message. True only if there is a registered override owner. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| IsRegistered
| Property,<br>'''Read-only''',<br>boolean
| Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. See [[AutoScript_Messages#Ownership vs. Usage|Ownership vs. Usage]] for more information.
|-
| Name
| Property,<br>'''Read-only''',<br>String
| Contains Message name.
|-
| [[AutoScript_Dynamic_Objects|Response]]
| Property,<br>'''Read-only''',<br>Object
| This property is a [[AutoScript_Dynamic_Objects|Dynamic Object]] representing the Response payload of the Message User. The property exists only if the message is defined with a response payload. See [[AutoScript_Messages#Message Payloads|Message Payloads]] for more information.
|-
| '''void SendAndRead ()'''  
| Method  
| Method  
| Send and read method.
| This method exists only for Two-Way Messages. See [[AutoScript_Messages#Two-Way Messaging|Two-Way Messaging]] for more information.
|-
|-
|  
| '''void SendAndReadBypassOverride ()'''
HRESULT'''&nbsp;SendAndReadBypassOverride ('''
 
bool* value
 
''')'''
 
| Method  
| Method  
| Send and read bypass override method.
| This method exists only for Two-Way Messages. See [[AutoScript_Messages#Two-Way Messaging|Two-Way Messaging]] for more information.
|-
|-
| HRESULT'''&nbsp;SendCmd (void)'''  
| '''void SendCmd ()'''  
| Method  
| Method  
| Send command method.
| This method exists only for Two-Way and One-Way Command Messages. See [[AutoScript_Messages#Two-Way Messaging|Two-Way Messaging]] and [[AutoScript_Messages#One-Way Messaging|One-Way Messaging]] for more information.
|-
|-
| HRESULT'''SendCmdBypassOverride ('''<br>&nbsp;&nbsp; bool* value <br>''')'''  
| '''void SendCmdBypassOverride ()'''  
| Method  
| Method  
| Send command bypass override method.
| This method exists only for Two-Way and One-Way Command Messages. See [[AutoScript_Messages#Two-Way Messaging|Two-Way Messaging]] and [[AutoScript_Messages#One-Way Messaging|One-Way Messaging]] for more information.
|-
|-
| HRESULT'''Subscribe (void)'''  
| '''void Subscribe ()'''  
| Method  
| Method  
| Subscribe method.
| This method exists only for Broadcast Messages. This method subscribes this message owner to receive message broadcasts from the given message. See [[AutoScript_Messages#Broadcast Messaging|Broadcast Messaging]] for more information.
|-
| SUID
| Property,<br>'''Read-only''',<br>int
| STRIDE Unique Identifier assigned by compiler.
|-
| Type
| Property,<br>'''Read-only''',<br>String
| Contains message type defined by the SCL declaration. Legal values include:
* "OneWayMessage"
* "OneWayResponse"
* "TwoWayMessage"
* "BroadcastMessage"
|-
|-
| HRESULT '''Unsubscribe (void)'''  
| '''void Unsubscribe ()'''  
| Method  
| Method  
| Unsubscribe method.
| Unsubscribe method exists only for Broadcast Messages. This method unsubscribes this message owner from given message's broadcasts. See [[AutoScript_Messages#Broadcast Messaging|Broadcast Messaging]] for more information.
 
|}
|}


=== <br><br>Ascript.TestUnits<br> ===


TestUnits is a collection of test units contained and managed through Ascript.  
 
== ascript.TestUnits ==
 
TestUnits is a collection of [[#ascript.TestUnits.Item|TestUnit]] Objects contained and managed through ascript.  


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 513: Line 668:
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | Method
| valign="top" | Method
| valign="top" | Sorts the Test Units collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Test Units should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values.
| valign="top" | Sorts the Test Units collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may be set to "Name" only. If not specified, the default is "Name". This represents how Test Units should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values.
|-
|-
| valign="top" | Count
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>Integer
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Test Units in this collection.<br>
| valign="top" | Returns the number of Test Units in this collection.<br>
|-
|-
| valign="top" align="left" width="150" |  
| valign="top" align="left" width="150" |  
[[#Ascript.TestUnits.Item|object]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; integer index<br>''')'''
[[#ascript.TestUnits.Item|TestUnit]]&nbsp;'''Item '''(<br>&nbsp;&nbsp;&nbsp; int Index<br>''')'''


| valign="top" | Method<br>
| valign="top" | Method<br>
Line 528: Line 683:
<br>
<br>


==== <br>Ascript.TestUnits.Item<br> ====
=== <br>ascript.TestUnits.Item<br> ===


The Test Unit object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the TestUnits collection and is accessed from the collection using the item(#) interface.  
The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the [[#ascript.TestUnits|TestUnits]] collection and is accessed from the collection using the item(#) interface.  


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 540: Line 695:
| valign="top" align="left" width="150" | Arguments  
| valign="top" align="left" width="150" | Arguments  
| valign="top" align="left" | Object  
| valign="top" align="left" | Object  
| valign="top" align="left" | Test Unit parameter list payload.
| valign="top" align="left" | Contains the Test Unit's parameter list payload.
|-
| valign="top" align="left" width="150" | IsRegistered
| valign="top" align="left" | Property,<br>'''Read-only''',<br>boolean
| valign="top" align="left" | Contains true if the Test Unit owner has registered on the target side.
|-
|-
| valign="top" align="left" width="150" | Name  
| valign="top" align="left" width="150" | Name  
Line 546: Line 705:
| valign="top" align="left" | Test Unit name.
| valign="top" align="left" | Test Unit name.
|-
|-
| valign="top" align="left" width="150" | IsRegistered
| valign="top" align="left" width="150" | '''void Run ()'''&nbsp;  
| valign="top" align="left" | Property,<br>'''Read-only''',<br>bool
| valign="top" align="left" | Contains true if the Test Unit owner has registered on the target side.
|-
| valign="top" align="left" width="150" | '''void Run (void)'''&nbsp;  
| valign="top" align="left" | Method  
| valign="top" align="left" | Method  
| valign="top" align="left" | Method to run the test unit.
| valign="top" align="left" | Method to run the test unit. Calling this method will run the test unit in a blocking call until the test unit completes processing.
|-
|-
| valign="top" align="left" width="150" | Suite&nbsp;
| valign="top" align="left" width="150" | [[Reporter#reporter.Suites.Item|Suite]]
| valign="top" align="left" | Property,<br>object
| valign="top" align="left" | Property,<br>Object
| valign="top" align="left" | An object of type Reporter's TestSuite. By default after a run this object is a sub-Suite of ascript.TestSuite with the same name as the Test Unit (null if no reporting performed). Setting Suite to a concrete external TestSuite prior to execution will override default creation behavior (set to null to revert to default behavior).
| valign="top" align="left" | An object of type Reporter's [[Reporter#reporter.Suites.Item|Suite]]. By default after a run this object is a sub-Suite of ascript.TestSuite with the same name as the Test Unit (null if no reporting performed). Setting Suite to a concrete external TestSuite prior to execution will override default creation behavior (set to null to revert to default behavior).
|-
|-
| valign="top" align="left" width="150" | Summary  
| valign="top" align="left" width="150" | Summary  
| valign="top" align="left" | Property,<br>integer
| valign="top" align="left" | Property,<br>int
| valign="top" align="left" | Contains static payload object of type srTestCaseTotals_t with result (i.e. pass, fail, in progress, not in use).
| valign="top" align="left" | Contains static payload object of type srTestCaseTotals_t with one of the following:
* srTEST_PASS
* srTEST_FAIL
* srTEST_NOTINUSE
* srTEST_INPROGRESS
|-
|-
| valign="top" align="left" width="150" | Type
| valign="top" align="left" width="150" | Type
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String  
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String  
| valign="top" align="left" | Contains test unit type (i.e. TestClass, TestCClass, or TestFList).
| valign="top" align="left" | Contains test unit type:
* "TestClass"
* "TestCClass"
* "TestFList"
|}
|}


<br>
<br>


=== <br>Ascript.Timers<br> ===
== <br>ascript.Timers<br> ==
 
The Timers collection manages a set of [[#Ascript.Timers.Item|Timers]]. The Timers allow scripts to generate periodic or 'one-shot' timed events.<br>
 
Upon creation, the Timers collection is empty.<br>
 
The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts.<br>
 
From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.<br>
 
A time object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case.<br>


The collection remains unsorted (Timer objects are held in the order in which they were added) unless ArrangeBy() is called. <br>
The Timers collection manages a set of [[#ascript.Timers.Item|Timer]] Objects. The Timers allow scripts to generate periodic or 'one-shot' timed events. Upon creation, the Timers collection is empty. The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts.  From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.<br>


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 589: Line 741:
| bgcolor="#66ff99" | '''Description'''<br>
| bgcolor="#66ff99" | '''Description'''<br>
|-
|-
| valign="top" align="left" width="150" | [[#Ascript.Timers.Item|object]] '''Add''' (<br>&nbsp;&nbsp;&nbsp; [[#Ascript.Timers.Item|object]]&nbsp;timerObject<br>''')'''  
| valign="top" align="left" width="150" | [[#ascript.Timers.Item|Timer]] '''Add''' (<br>&nbsp;&nbsp;&nbsp; String Name<br>''')'''  
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Adds a new timer object.
| valign="top" align="left" | Creates and adds a new timer object with the given name. Returns the new Timer object. An exception is thrown if a Timer was already created with the given name.
|-
|-
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | '''void ArrangeBy ('''<br>&nbsp;&nbsp;&nbsp;String By [optional], <br>&nbsp;&nbsp;&nbsp;String Order [optional]<br>''')'''
| valign="top" | Method
| valign="top" | Method
| valign="top" | Sorts the Timers collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Timers should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>Exception thrown if either argument is outside legal values.
| valign="top" | Sorts the Timers collection so that indexing by position yields predictable results.<br><br>The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Timers should be sorted in the collection.<br><br>The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".<br><br>An exception is thrown if either argument is outside legal values.
|-
|-
| valign="top" | Count
| valign="top" | Count
| valign="top" | Property,<br>'''Read-only''',<br>Integer
| valign="top" | Property,<br>'''Read-only''',<br>int
| valign="top" | Returns the number of Timers in this collection.<br>
| valign="top" | Returns the number of Timers in this collection.<br>
|-
|-
| valign="top" align="left" width="150" | [[#Ascript.Timers.Item|object]]&nbsp;'''Item (<br>'''&nbsp;&nbsp;&nbsp; integer index<br>''')'''  
| valign="top" align="left" width="150" | [[#ascript.Timers.Item|Timer]]&nbsp;'''Item (<br>'''&nbsp;&nbsp;&nbsp; int Index<br>''')'''  
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Retrieves the Timer object for the given index.
| valign="top" align="left" | Retrieves the Timer object for the given index.
|-
|-
| valign="top" align="left" width="150" | [[#Ascript.Timers.Item|object]] '''Remove '''(<br>&nbsp;&nbsp;&nbsp; integer index<br>''')'''  
| valign="top" align="left" width="150" | [[#ascript.Timers.Item|Timer]] '''Remove ('''<br>&nbsp;&nbsp;&nbsp; int Index<br>''')'''  
| valign="top" | Method<br>
| valign="top" | Method<br>
| valign="top" | Removes the timer at the given index.<br>
| valign="top" | Removes the timer at the given index.<br>A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case.
|}
|}


<br>
<br>


==== <br>Ascript.Timers.Item<br> ====
=== <br>ascript.Timers.Item<br> ===


The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.<br>
The ascript [[#ascript.Timers|Timers]] Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.<br>


When a timer expires and rires its event, the event is queued and can be accessed by the ascript.WaitForEvent() method. The expired timer object will be returned by WaitForEvent();<br>
When a timer expires and rires its event, the event is queued and can be accessed by the [[AutoScript_Events#WaitForEvent|WaitForEvent]] method. The expired timer object will be returned by WaitForEvent.<br>


{| cellspacing="0" cellpadding="10" width="100%" border="1"
{| cellspacing="0" cellpadding="10" width="100%" border="1"
Line 625: Line 777:
|-
|-
| valign="top" align="left" width="150" | Active  
| valign="top" align="left" width="150" | Active  
| valign="top" align="left" | Property,<br>'''Read-only,'''<br>bool
| valign="top" align="left" | Property,<br>'''Read-only,'''<br>boolean
| valign="top" align="left" | Contains timer operation state. True if timer is in operation (i.e. it will generate an event at some time in the future). A newly created timer is inactive by default.
| valign="top" align="left" | Contains timer operation state. True if timer is in operation (i.e. it will generate an event at some time in the future). A newly created timer is inactive by default.
|-
| valign="top" align="left" width="150" | Duration
| valign="top" align="left" | Property,<br>int
| valign="top" align="left" | Timer duration in milliseconds.
|-
|-
| valign="top" align="left" width="150" | Id  
| valign="top" align="left" width="150" | Id  
| valign="top" align="left" | Property,<br>'''Read-only,'''<br>long
| valign="top" align="left" | Property,<br>'''Read-only,'''<br>int
| valign="top" align="left" | Contains timer identifier.
| valign="top" align="left" | Contains timer identifier.
|-
| valign="top" align="left" width="150" | Duration
| valign="top" align="left" | Property,<br>long
| valign="top" align="left" | Timer duration in milliseconds.
|-
|-
| valign="top" align="left" width="150" | Name
| valign="top" align="left" width="150" | Name
Line 641: Line 793:
|-
|-
| valign="top" align="left" width="150" | Periodic  
| valign="top" align="left" width="150" | Periodic  
| valign="top" align="left" | Property,<br>bool&nbsp;  
| valign="top" align="left" | Property,<br>boolean&nbsp;  
| valign="top" align="left" | When false, the time will fire only once (one-shot mode). When true, the time automatically restarts after each event is fired. This property can be changed regardless of the state of the timer.&nbsp;This field is false by default when a&nbsp;timer is created.&nbsp;
| valign="top" align="left" | When false, the time will fire only once (one-shot mode). When true, the time automatically restarts after each event is fired. This property can be changed regardless of the state of the timer.&nbsp;This field is false by default when a&nbsp;timer is created.&nbsp;
|-
|-
| valign="top" align="left" width="150" | '''void Start&nbsp;(void)'''  
| valign="top" align="left" width="150" | '''void Start&nbsp;()'''  
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Transitions an inactive timer to active. Once started, the timer will run for the length of time specified by its Duration property. Calling Start on a timer with a zero/negative duration will cause an exception to be thrown. Calling Start on a timer that has already started will also cause an exception to be thrown.
| valign="top" align="left" | Transitions an inactive timer to active. Once started, the timer will run for the length of time specified by its Duration property. Calling Start on a timer with a zero/negative duration will cause an exception to be thrown. Calling Start on a timer that has already started will also cause an exception to be thrown.
|-
|-
| valign="top" align="left" width="150" | '''void Stop&nbsp;(void)'''  
| valign="top" align="left" width="150" | '''void Stop&nbsp;()'''  
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Method<br>
| valign="top" align="left" | Transitions an active timer to inactive. Calling Stop on a timer that is not active will cause an exception to be thrown.
| valign="top" align="left" | Transitions an active timer to inactive. Calling Stop on a timer that is not active will cause an exception to be thrown.
Line 654: Line 806:
| valign="top" align="left" width="150" | Type
| valign="top" align="left" width="150" | Type
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String  
| valign="top" align="left" | Property,<br>'''Read-only''',<br>String  
| valign="top" align="left" | Contains the string "Timer". This property is typically used to classify an object that is returned from ascript.WaitForEvent().
| valign="top" align="left" | Contains the string "Timer". This property is typically used to classify an object that is returned from the [[AutoScript_Events#WaitForEvent|WaitForEvent]] method.
|}
|}
= Advanced Topics =
The following topics are all reachable through the prior tables (either directly or indirectly). They are listed here for convenience.
* [[AutoScript_Dynamic_Objects|Dynamic Objects]]
* [[AutoScript Events]]
* [[AutoScript Functions]]
* [[AutoScript Messages]]
[[Category: Studio]]

Latest revision as of 21:22, 18 August 2009

 

Introduction 

AutoScript (AScript) is a COM Automation API that provides functionality allowing host-based scripts to interact with target-based binaries through the STRIDE Runtime. Through AScript, you can:

  • call target-based functions and messages (synchronously or asynchronously)
  • set and read parameter values of these functions and messages
  • transparently emulate (mock) target-based functions

AutoScript Automation Usage

In scripts run inside STRIDE Studio AScript could be accessed through a auto-injected system object called ascript. When creating a script, the user is provided with in-place Autosense (see below) that helps the user to find the script methods/data desired.

Ascriptpopup.jpg

Ascript API

The ascript object is the top-most object when accessing methods and properties related to Ascript. The following table describes what is available from the ascript object. Other nested properties and methods may be found in the folowing sections.

Member
Type
Description
Arguments Collection Collection of arguments.
Constants Collection Collection of constants.
Database Object  Database settings.
Functions Collection Collection of functions.
void Initialize (
   String STIDName,
   String databaseFile,
   int MessageBoxTimeout [optional]
)
Method Initializes and ascript object instance that has been created outside of the STRIDE Studio environment. This call is needed only on an explicitly-created ascript instance. This call should not be made on an ascript instance automatically created and injected into a script by STRIDE Studio.
IsEventPending Property,
Read-only,
boolean
Contains true if there is at least one event in this script's message queue. Events are retrieved from the queue using the WaitForEvent method (ascript.WaitForEvent()).
LogicalPath Property,
Read-only,
String
Contains the script's path in the STRIDE Studio workspace tree.
String MessageBox( 
   String Message,
   String Title [optional], 
   String Type
)
Method Displays a model message box dialog.


Acceptable strings for type include:

  • "OK"
  • "OKCANCEL"
  • "RETRYCANCEL"
  • "YESNO"
  • "YESNOCANCEL"


Returns a string indicating the action used to dismiss the message box. Strings returned include:

  • "ABORT"
  • "CANCEL"
  • "IGNORE"
  • "YES"
  • "NO"
  • "OK"
Messages Collection Collection of messages.
Output Property,
(String, Integer, or Object)
This is the return value from a RunBlocking() call that invoked this script. This works only when the script is invoked using RunBlocking() in the studio object model.
RspTimeoutPeriod Property,
int
This value controls the timeout threshold for test unit run, synchronous function call and two-way message send (in milliseconds). A zero value indicates no timeout. For interactively run scripts the timeout behavior may be different. Specific calls affected by this value are:
ScriptName Property,
Read-only,
String
Contains the name of the currently running script with extension and without path. If the current ascript instance was instantiated and initialized outside of STRIDE Studio, this value will reflect the STIDName passed to ascript.Initialize().
void Sleep(
   int Period
)
Method Time to pause (in milliseconds). Allowable range is 0 -1440000 (24 hours).
TestSuite Property,
Object
An object of type Reporter's Suite. By default it is set to the associated with the script testSuite object but can be overriden by the user as needed.
TestUnits Collection Collection of test units.
Timers Collection Collection of timers.
Event WaitForEvent ( void ) Method Pauses script execution until an event is detected in this script's event queue. See WaitForEvent for more information on this method.
WaitTimeoutPeriod Property,
String
The timeout threshold (in milliseconds) for asynchronous function and message calls. A zero value indicates no timeout.


ascript.Arguments

The Arguments collection manages a list of Arguments passed to a script which has been invoked via one of the following methods of the Studio Object Model's File object:

  • RunBlocking([arg1], [arg2], ...)
  • RunNonBlocking([arg1], [arg2], ...)


The default sort order of the member argument objects is the order in which the arguments were given in the call where the script was invoked.

Member
Type
Description
Count Property,
Read-only,
int
Returns the number of Arguments in this collection.

Argument Item (
    int Index
)

Method
Retrieves the argument at the given index. An exception is thrown if the index is out of range.

Argument Item (
    String Name
)

Method
Retrieves the argument with the given name. If a named argument doesn't exist, null is returned.



ascript.Arguments.Item

The ascript Arguments Collection's Item() method returns an Argument Object.

Member
Type
Description
Name Property,
Read-only,
String

The argument name. The name may have been specified in the studio automation RunBlocking() or RunNonBlocking() call that launched the script or if not specified the name is synthesized by the ascript object.

When synthesized, the name is of the form "Unnamed_N" where 'N' is a monotonically incremented number starting from 0.

Value  Property,
Read-only,
String, Integer, or Object
The argument value.


ascript.Constants

The Constants collection contains Constants objects that represent all constants in C/C++ source code compiled by the STRIDE compiler. Constants include all #define symbols and enumerated constants.

Member
Type
Description
void ArrangeBy (
   String By [optional],
   String Order [optional]
)
Method Sorts the Constants collection so that indexing by position yields predictable results.

The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Constants should be sorted in the collection.

The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".

Exception thrown if either argument is outside legal values.
Count Property,
Read-only,
int
Returns the number of Constants in this collection.

Constant Item (
    int Index
)

Method
Retrieves the constant at the given index. An exception is thrown if the index is out of range.

Constant Item (
    String Name
)

Method
Retrieves the constant with the given name. If a named constant doesn't exist, null is returned.




ascript.Constants.Item

The ascript Constants Collection's Item() method returns a Constant object.

Member
Type
Description
Name Property,
Read-only,
String
The name of the constant.
Value Property,
Read-only,
String
The value of the constant.



ascript.Database

The Database object represents the currently-loaded STRIDE database managed by ascript. You can combine the values of the database path and name to construct a fully-qualified filename. For example:

var dbFullPath = ascript.Database.Path + "\\" + ascript.Database.Name;

Member
Type
Description
Name Property,
Read-only,
String
The name of the database in use. The database name includes the ".sidb" extension.
Path
Property,
Read-only,
String
The path to the STRIDE database in use. The path does not contain a trailing backslash.


ascript.Functions

The Functions collection represents all captured Function interfaces in the active database.

Member
Type
Description
void ArrangeBy (
   String By [optional],
   String Order [optional]
)
Method Sorts the Functions collection so that indexing by position yields predictable results.

The 'By' parameter may be either "Name" or "SUID". If not specified, the default is "Name". This represents how Functions should be sorted in the collection.

The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".

Exception thrown if either argument is outside legal values.
Count Property,
Read-only,
int
Returns the number of Functions in this collection.

Function Item (
    int Index
)

Method
Retrieves the function at the given index. An exception is thrown if the index is out of range.

Function Item (
  String Name
)

Method
Retrieves the function with the given name. A null value is returned if there is no function with the given name.


ascript.Functions.Item

The Function object represents a captured function interface in the currently active STRIDE database. A Function object always exists as a member of the Functions collection.

Member
Type
Description
Name Property,
Read-only,
boolean
Function's name.
Owner Property,
Read-only,
Object
Function's owner object. The owner object provides access to properties and methods used by the owner-side of the function interface. The owner-side of the interface is used by the implementor of the function.
SUID Property,
Read-Only,
int
STRIDE Unique IDentifier assigned by compiler.
Type Property,
Read-Only,
String
Contains the string "Function".
User Property
Read-Only,
Object
Function's user object. The user object provides access to properties and methods used by the user-side of the function interface. The user-side of the interface is used by the caller of the function.


ascript.Functions.Item.Owner

The Function Owner object represents the Owner (callee) side of a function. The Owner object is used to implement a function in script that can be called through the STRIDE Runtime. The Function Owner object is reachable from a Function object's owner property.

Member
Type
Description
IsOverrideRegistered Property,
Read-Only,
boolean
Contains true if there is a registered override owner. See Ownership vs. Usage for more information.
IsRegistered Property,
Read-only,
boolean
Contains true if there is a registered owner, a registered override owner, or both. See Ownership vs. Usage for more information.
Name Property,
Read-only,
String
Owner name.
OutPointers Property,
Read-only,
Object
Contains the OutPointers payload of the Function User object. See Function Payloads for more information.
ParameterList Property,
Read-only,
Object
Contains the object representing the ParameterList payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a Dynamic Object. See Function Payloads for more information.
void Register () Method Registers the script from which it is called as the active owner of the function. If there is a currently registered owner or another registration failure, an exception is thrown. See Ownership vs. Usage for more information.
void RegisterOverride () Method Registers the script as the override registered owner. If the function already has an override registered owner or if there is another registration error, an exception is thrown. See Ownership vs. Usage for more information.
void Return () Method Causes a return from a function call made from another script. See Return for more information. The values of OutPointers and ReturnValue will be reflected to the caller (as long as they are consistent with the input values).
ReturnValue Property,
Read-only,
Integer
Contains the object representing the ReturnValue payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a Dynamic Object. See Function Payloads for more information.
SUID Property,
Read-only,
int
STRIDE-unique identifier assigned by compiler.
Type Property,
Read-only,
String
Contains "FunctionOwner". This property is typically used to classify an object that is returned from WaitForEvent.
void Unregister () Method Unregisters the script that was registered as the owner of the function from a prior Register call. If the current script is not the owner or if unregistration fails, an exception is thrown. See Ownership vs. Usage for more information.
void UnregisterOverride () Method Unregisters the script that was registered as the override owner of the function from a prior RegisterOverride call. If the current script is not the registered override owner or if unregistration fails, an exception is thrown. See Ownership vs. Usage for more information.


ascript.Functions.Item.User

The Function User object represents the User (caller) side of a function. The User object is used to call a function through the STRIDE Runtime. The Function User object is reachable from a Function object's User property.

Member
Type
Description
void Call () Method Synchronously calls the registered owner of the function (Blocking call). See Synchronous Calls for more information.
void CallBypassOverride () Method Synchronously calls the registered owner bypassing the registered override owner of the function (Blocking call). See Synchronous Calls for more information.
void CallBypassOverrideNonBlocking () Method Asynchronously calls the registered owner bypassing the registered override owner of the function (Non-blocking call). See Asynchronous Calls for more information.
void CallNonBlocking () Method Asynchronously calls the registered owner of the function (Non-blocking call). See Asynchronous Calls for more information.
IsOverrideRegistered Property,
Read-only,
boolean
Contains true if there is a registered override owner. See Ownership vs. Usage for more information.
IsRegistered Property,
Read-only,
boolean
Contains true if there is a registered owner, a registered override owner, or both. See Ownership vs. Usage for more information.
Name Property,
Read-only,
String
User function name.
OutPointers Property,
Read-only,
Object
Contains the OutPointers payload of the Function User object. See Function Payloads for more information.
ParameterList Property,
Read-only,
Object
Contains the object representing the ParameterList payload of the Function Owner. Functions without parameters will not have this property. Before calling the function, all relevent fields in the ParameterList property must be set (includeing the fields of any child objects). These values are marshaled to the currently registered Owner of the function when it is called. This property is a Dynamic Object. See Function Payloads for more information.
ReturnValue Property,
Read-only,
Object
Contains the object representing the ReturnValue payload of the Function Owner. Functions returning void will not have this property. Upon return this property will reflect the ReturnValue set by the function Owner. This property is a Dynamic Object. See Function Payloads for more information.
SUID Property,
Read-only,
,int
STRIDE-unique identifier assigned by compiler.
Type Property,
Read-only,
String
Contains "FunctionUser". This property is typically used to classify an object that is returned from WaitForEvent.



ascript.Messages

The Messages Collection is a collection of captured Message objects.

Member
Type
Description
void ArrangeBy (
   String By [optional],
   String Order [optional]
)
Method Sorts the Messages collection so that indexing by position yields predictable results.

The 'By' parameter may one of the following: "Name", "SUID", or "Type". The default sorting order is by "Name". This represents how Timers should be sorted in the collection. A runtime exception is thrown if an invalid value is passed

The 'Order' parameter may be either "Ascending" or "Descending" and is not case sensitive. If not specified, the default is "Ascending". A runtime exception is thrown if a invalid value is passed.
Count Property,
Read-only,
int
Returns the number of Messages in this collection.

Message Item (
    int Index
)

Method
Retrieves the message at the given index.

Message Item (
    String Name
)

Method
Retrieves the message with the given name.



ascript.Messages.Item

The Message object represents a captured message interface in the currently active STRIDE database. A Message object is always a member of the Messages collection.

Member
Type
Description
Name Property,
Read-only,
String
Message name.
Owner Property,
Read-only,
Object
Message's owner object.
SUID Property,
Read-only,
int
STRIDE Unique Identifier assigned by compiler.
Type Property,
Read-only,
String
Contains message type defined by the SCL declaration. Legal values include:
  • "OneWayMessage"
  • "OneWayResponse"
  • "TwoWayMessage"
  • "BroadcastMessage"
User Property,
Read-only,
Object
Message's user object.


ascript.Messages.Item.Owner

The Message Owner object represents the Owner-side of a Message. This may be a receiver of a one-way or two-way message. It may also be the broadcaster of a broadcast message. The Owner object may be used to implement the message owner in a script that can be called through the STRIDE Runtime.
This object allows access to the message destination. The message can be routed to any of the following:

  • the original on-target receiver
  • a window in STRIDE Studio
  • a script running in Studio


Member
Type
Description
void Broadcast () Method Broadcast method exists only for Broadcast Messages. This method broadcasts this message to all message users that have subscribed to this message. The Response payload values are marshaled to all subscribed message users. See Broadcast Messaging for more information.
Command Property,
Read-only,
Object
This property is a Dynamic Object representing the Command payload of the Message Owner. The property exists only if the captured message took one or more parameters. The property contains all the values of the Message User Command fields at the time that the message User called the Owner. See Message Payloads for more information.
IsOverrideRegistered Property,
Read-only,
boolean
Contains the override Owner registration state of the message. True only if there is a registered override owner. See Ownership vs. Usage for more information.
IsRegistered Property,
Read-only,
boolean
Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. See Ownership vs. Usage for more information.
Name Property,
Read-only,
String
Contains Message name.
void Register () Method This method only exists for One-Way Command or Two-Way Messages. The calling script is registered as the active owner of the message. If there is already a registered owner or if there is some other registration failure, an exception is thrown. See Ownership vs. Usage for more information.
void RegisterOverride () Method This method only for One-Way Command or Two-Way Messages. The calling script is registered as the registered override owner (such that all future messages are routed to this owner over and above the registered owner). If there is already an override owner or if there is another registration failure, an exception is thrown. See Ownership vs. Usage for more information.
Response Property,
Read-only,
Object
This property is a Dynamic Object representing the Response payload of the Message Owner. The property exists only if the message is defined with a response payload. See Message Payloads for more information.
void SendRsp () Method Send response method exists only for One-Way Response or Two-Way Messages. The method sends the message as a response to a prior message command from a message user. If there is not pending message response expected an exception is thrown. After setting values of the response payload, a script that implements an Owner message calls SendRsp() to reply to an earlier two-way message (or one-way response). The effect of this call on the calling (User) script depends on how the earlier user message was sent. See Point-to-Point Messaging for more information.
SUID Property,
Read-only,
int
STRIDE Unique Identifier assigned by compiler.
Type Property,
Read-only,
String
Contains message type defined by the SCL declaration. Legal values include:
  • "OneWayMessage"
  • "OneWayResponse"
  • "TwoWayMessage"
  • "BroadcastMessage"
void Unregister () Method This method only exists for One-Way Command or Two-Way Messages. This method unregisters the current script as the owner of the message. If the current script is not the registered owner or if unregistration fails, an exception is thrown. See Ownership vs. Usage for more information.
void UnregisterOverride () Method This method exists only for One-Way Command or Two-Way Messages. This method unregisters the current script as registered override owner. If the current script is not the registered override owner or if registration fails, an exception is thrown. See Ownership vs. Usage for more information.


ascript.Messages.Item.User

The Message User object represents the User-side of a Message. This may be a sender of a one-way or two-way message. It may also be the receiver of a broadcast message. The User object may be used to send a message from a script to the registered message owner through the STRIDE Runtime.

Member
Type
Description
Command Property,
Read-only,
Object
This property is a Dynamic Object representing the Command payload of the Message User. The property exists only if the captured message took one or more parameters. The values of all Message User Command payload fields should be set before the Message Owner is called. See Message Payloads for more information.
IsOverrideRegistered Property,
Read-only,
boolean
Contains the override Owner registration state of the message. True only if there is a registered override owner. See Ownership vs. Usage for more information.
IsRegistered Property,
Read-only,
boolean
Contains the Owner registration state of the message. True only if there is a registered owner, a registered override owner, or both. See Ownership vs. Usage for more information.
Name Property,
Read-only,
String
Contains Message name.
Response Property,
Read-only,
Object
This property is a Dynamic Object representing the Response payload of the Message User. The property exists only if the message is defined with a response payload. See Message Payloads for more information.
void SendAndRead () Method This method exists only for Two-Way Messages. See Two-Way Messaging for more information.
void SendAndReadBypassOverride () Method This method exists only for Two-Way Messages. See Two-Way Messaging for more information.
void SendCmd () Method This method exists only for Two-Way and One-Way Command Messages. See Two-Way Messaging and One-Way Messaging for more information.
void SendCmdBypassOverride () Method This method exists only for Two-Way and One-Way Command Messages. See Two-Way Messaging and One-Way Messaging for more information.
void Subscribe () Method This method exists only for Broadcast Messages. This method subscribes this message owner to receive message broadcasts from the given message. See Broadcast Messaging for more information.
SUID Property,
Read-only,
int
STRIDE Unique Identifier assigned by compiler.
Type Property,
Read-only,
String
Contains message type defined by the SCL declaration. Legal values include:
  • "OneWayMessage"
  • "OneWayResponse"
  • "TwoWayMessage"
  • "BroadcastMessage"
void Unsubscribe () Method Unsubscribe method exists only for Broadcast Messages. This method unsubscribes this message owner from given message's broadcasts. See Broadcast Messaging for more information.


ascript.TestUnits

TestUnits is a collection of TestUnit Objects contained and managed through ascript.

Member
Type
Description
void ArrangeBy (
   String By [optional],
   String Order [optional]
)
Method Sorts the Test Units collection so that indexing by position yields predictable results.

The 'By' parameter may be set to "Name" only. If not specified, the default is "Name". This represents how Test Units should be sorted in the collection.

The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".

Exception thrown if either argument is outside legal values.
Count Property,
Read-only,
int
Returns the number of Test Units in this collection.

TestUnit Item (
    int Index
)

Method
Retrieves the test unit at the given index.



ascript.TestUnits.Item

The TestUnit Object represents a captured Test Unit interface in the currently active STRIDE database. A Test Unit object always exists as a member of the TestUnits collection and is accessed from the collection using the item(#) interface.

Member
Type
Description
Arguments Object Contains the Test Unit's parameter list payload.
IsRegistered Property,
Read-only,
boolean
Contains true if the Test Unit owner has registered on the target side.
Name Property,
Read-only,
String
Test Unit name.
void Run ()  Method Method to run the test unit. Calling this method will run the test unit in a blocking call until the test unit completes processing.
Suite Property,
Object
An object of type Reporter's Suite. By default after a run this object is a sub-Suite of ascript.TestSuite with the same name as the Test Unit (null if no reporting performed). Setting Suite to a concrete external TestSuite prior to execution will override default creation behavior (set to null to revert to default behavior).
Summary Property,
int
Contains static payload object of type srTestCaseTotals_t with one of the following:
  • srTEST_PASS
  • srTEST_FAIL
  • srTEST_NOTINUSE
  • srTEST_INPROGRESS
Type Property,
Read-only,
String
Contains test unit type:
  • "TestClass"
  • "TestCClass"
  • "TestFList"



ascript.Timers

The Timers collection manages a set of Timer Objects. The Timers allow scripts to generate periodic or 'one-shot' timed events. Upon creation, the Timers collection is empty. The Timers collection is the only read/write collection in STRIDE; member Timer objects can be added (implicitly created) and removed by scripts. From the collection's point of view, member Timers have two states: dead and alive. Timers are alive upon creation and remain so as long as they exist in the collection. A Timer object that is removed from the collection is considered dead. Any operation on a dead timer will cause an exception to be thrown.

Member
Type
Description
Timer Add (
    String Name
)
Method
Creates and adds a new timer object with the given name. Returns the new Timer object. An exception is thrown if a Timer was already created with the given name.
void ArrangeBy (
   String By [optional],
   String Order [optional]
)
Method Sorts the Timers collection so that indexing by position yields predictable results.

The 'By' parameter may only be "Name". If not specified, the default is "Name". This represents how Timers should be sorted in the collection.

The 'Order' parameter may be either "Ascending" or "Descending". If not specified, the default is "Ascending".

An exception is thrown if either argument is outside legal values.
Count Property,
Read-only,
int
Returns the number of Timers in this collection.
Timer Item (
    int Index
)
Method
Retrieves the Timer object for the given index.
Timer Remove (
    int Index
)
Method
Removes the timer at the given index.
A timer object that is removed from the collection is automatically stopped before removal if it is active. No event is generated in this case.



ascript.Timers.Item

The ascript Timers Collection's Item() method returns a Timer Object. The Timer object enables scripting clients to synthesize and receive timer-based periodic or one-shot events.

When a timer expires and rires its event, the event is queued and can be accessed by the WaitForEvent method. The expired timer object will be returned by WaitForEvent.

Member
Type
Description
Active Property,
Read-only,
boolean
Contains timer operation state. True if timer is in operation (i.e. it will generate an event at some time in the future). A newly created timer is inactive by default.
Duration Property,
int
Timer duration in milliseconds.
Id Property,
Read-only,
int
Contains timer identifier.
Name Property,
Read-only,
String
Name assigned when the timer was created. Default names are "Timer_n" where 'n' is the nth named time created by this ascript object.
Periodic Property,
boolean 
When false, the time will fire only once (one-shot mode). When true, the time automatically restarts after each event is fired. This property can be changed regardless of the state of the timer. This field is false by default when a timer is created. 
void Start () Method
Transitions an inactive timer to active. Once started, the timer will run for the length of time specified by its Duration property. Calling Start on a timer with a zero/negative duration will cause an exception to be thrown. Calling Start on a timer that has already started will also cause an exception to be thrown.
void Stop () Method
Transitions an active timer to inactive. Calling Stop on a timer that is not active will cause an exception to be thrown.
Type Property,
Read-only,
String
Contains the string "Timer". This property is typically used to classify an object that is returned from the WaitForEvent method.

Advanced Topics

The following topics are all reachable through the prior tables (either directly or indirectly). They are listed here for convenience.