persistent class %WebStress.Scripts
extends %Persistent, %XML.Adaptor, %ZEN.DataModel.Adaptor
These are the recorded scripts that will be played back against the test system
parameter FileTimestamp = "60009,39315";
property ContainsCSPToken
as %Boolean;
Indicates whether one or more of the URLs for this script contains a CSPToken (protected/encrypted page)
property ErrorCheck
as %String(TRUNCATE=1);
The code to call to see if the returned page was an error.
This should in the form of a function that returns a zero or non-zero value where zero = no errors and non-zero = errors found
Examples:
$$IsError^MyScript()
##class(User.Script).IsError()
property Name
as %String(TRUNCATE=1);
A unique name for this script
property OriginalPort
as %String(TRUNCATE=1) [ InitialExpression = 80 ];
This is the default port that is used to communicate with the web server. It is assumed to be 80 unless otherwise specified.
It can be overridden by any URL
property OriginalServer
as %String(TRUNCATE=1);
This is the default web server address that will be used throughout the script.
It is taken from the first URL call.
The reason that we store it is so that it can be retrieved if any of the URLs throughout the script call other web servers
when it is overridden by that particular URL
property PostRunCode
as %String(MAXLEN=256,TRUNCATE=1);
The is the code that is executed at the end of each full script
It should take the form of a function that returns a zero or non-zero value indicating
whether the script should continue to run or not. (Zero = stop running, non-zero = continue to run the script)
Examples:
$$AtEnd^MyScript()
##class(User.Script).AtEnd()
property PreRunCode
as %String(MAXLEN=256,TRUNCATE=1);
The is the code that is executed before each run of the script.
It should take the form of a function that returns a zero or non-zero value indicating
whether the script can run or not. (Zero = do not run, non-zero = run script)
Examples:
$$Init^MyScript()
##class(User.Script).Init()
property RandomisationGenTime
as %Integer;
The date/time that the randomisation routine was automatically generated
property RandomisationRoutine
as %String(TRUNCATE=1);
The name of the routine that contains the randomisation code
property RecordDateTime
as %TimeStamp;
Date and time that this script was recorded
property RecordMethod
as %String(TRUNCATE=1) [ InitialExpression = "Manual" ];
This indicates the method used to build this script
property TotalLengthMins
as %Numeric [ Calculated ];
A calculation of how long the script would take to run based upon the delay time
between the user's input and the recorded length of time for the server to reply to
the request.
relationship URLs
as %WebStress.Scripts.URLS [ Inverse = Script,Cardinality = children ];
These are the details of each dialog between the browser and the web server
that all go together to form the total script.
classmethod CacheRecorder(scriptname As %String = "", creatertn As %Integer = 0, rtnname As %String = "")
as %String
Converts the output from a recorded session into a script with associated URLs etc.
Requires a script name as a parameter. Note that this is stored in the recorded data
after this method has been called meaning that subsequent calls to this method can be
left blank and the method will re-use the last supplied name.
creatertn is either 0 (zero) or non-zero indicating whether or not an automatic randomisation base routine
is to be created.
rtnname specifies the optional routine name if creatrtn is used.
classmethod CheckRoutineIsValid(id As %String)
as %Boolean
classmethod GetTotalLengthMins(id As %String)
method HomeDirectory()
as %String
classmethod MS2Cache(defaultnameprefix As %String = "Default_", overwrite As %Boolean = 1)
as %String
Gets data from MS Access and builds our scripts
First you need to follow these steps:
1. Setup a SYSTEM ODBC data source and use the Microsoft Access driver to point to the .mdb file created by the Microsoft tool
2. Setup a Cache SQL Gateway to point towards this ODBC data source
3. Use the Cache SQL Manager to link to the following tables in the .mdb file:
(a) Groups
(b) HTTPTransactions
(c) Scripts
These 3 steps should create the following Cache classes:
(a) %WebStress.WAST.Groups
(b) %WebStress.WAST.HTTPTransactions
(c) %WebStress.WAST.Scripts
Normally the name of the script would come from the .mdb file but a default can be supplied for the
cases where the value in the .mdb file is a null string. In this case the name of the script will be
the name of the default name prefix and then the group ID number
For example: if defaultnameprefix = "Default_" and the group ID is 3 then the name of the script
would be 'Default_3'
The overwrite key is used so that you can overcome the problem where MS Access lets two different
scripts have the same name. a ' (n)' is added to the end of the script name if overwrite is set to 0
For example the first file might be "Main Test" and the second would be "Main Test (2)"
classmethod MakeRtn(scriptid As %Integer, rtnName As %String = "")
as %String
This method can be called to automatically create the base routine for randomisation scripts.
It accepts two arguments:
scriptid = This is the internal ID number of the script. (Required)
rtnname = This is the name of the routine. (Optional). If not present this will default to "Random.Script.n"
where n is the scriptid number
method TotalLengthMinsGet()
as %Numeric
This is a Get accessor method for the TotalLengthMins property.
query ListByName()
SQL Query
:
SELECT %ID,Name,RecordDateTime FROM Scripts
ORDER BY Name
index (NameIndex on Name) [Unique];