Skip to main content
Version: 10.1

$.udb.benchmark.rec

warning

This article is under construction.

$.udb.benchmark.rec

This object exposes the Web benchmark recorder engine API.

The $.udb.benchmark.playback function exposes the Web Benchmark playback engine.

breakpoints: {}

Description

Contains all breakpoints set in the Edit test actions and parameters dialog. The breakpoints are only listed in the context of the currently selected test. Each breakpoint is set as a key-value (test step :true or false) pair object

Example

A test with a breakpoint set at step five:

breakpoints: {{5:true}}

createWaitFunctions: ƒ (entries)

Description

Constructs the wait conditions in the Extensions dialog as Javascript functions. The entries are fetched from indexeddb via the extensions table with type “wait”. The functions are stored in the waits array.

devMessages: []

Description

When $.udb.benchmark.events.recordmessage is triggered, the message object is pushed to this devMessages array. These are then displayed as developer alerts.

expandTest: ƒ ()

Description

Function used to display tests in edit tests dialog.

exportAsFile: ƒ (file, obj, type, ext)

Description

Exports data to file. Can be in XML format, JSON, or PDF (under development). The $.udb.benchmark.events.export event calls this function.

Options

  • file: filename
  • obj: the data to export (the XML is normally created by $.udb.benchmark.rec.makeXML() #makexml )
  • type: the content-type, currently either application/xml, application/json, or application/pdf
  • ext: the extension for the file, by default .xml

Example

Export a dummy file named “TestRun” with {} as file content in JSON format with extension json.txt:

$.udb.benchmark.rec.exportAsFile("TestRun", '{}' , "application/json", 'json.txt');

findAllRunsOfTest: ƒ (testName, options)

Description

executed in loop as soon as you open the Overview of test runs dialog , since it finds all runs for every existing test.

findControl: ƒ (rec, $target)

Description

Attempts to find the control on the displayed page. Called whenever you press the “Locate control in displayed page” button when editing a test action.

Options

rec  : the action containing the control to be located as an object.

findFolder: ƒ (testId)

Description

Helper function , calls $.udb.benchmark.storageFolder.findObject

findFolderByAlias: ƒ (alias)

Description

Helper function , calls $.udb.benchmark.storageFolder.findObject 

findFolderId: ƒ (testId)

Description

Helper function , calls $.udb.benchmark.storageFolder.findObject 

findTest: ƒ (id, folder)

Description

Helper function , calls $.udb.benchmark.storageFolder.mapArray

finishEvent: ƒ ()

Description

Called when a single action has finished recording. Preceeded by startEvent().

formatScriptResult: ƒ (scriptResult)

Description

Called whenever scripts are executed to apply formatting on the script result.

formatValues: ƒ (scriptResult, formatCols, nesting)

Description

Called by formatScriptResult.

getAction: ƒ (id, ref)

Description

Retrieves the action of a test, either matches the id or does a search based on the input

Returns an object containing the action.

Options

id : Either the exact number or,

lastClick to search for the most recent click action.

Use lastChangeable to search for the most recent change in records.

Use lastChange to search for the most recent change in records.

lastValue to search for the most recent value set action.

firstMessage to search for the most recent event that is not a message.

ref : The reference name of the control for which this action was recorded.

Example

Get the first action of the test:

$.udb.benchmark.rec.getAction(0)

Returns:

{  "action": "invoke",     

   “testName": "Test 3",     

   "disabled": false,     

   "paramSource": "newvalues",     

   "params": {         

      "a": "z"     }

getActionControlProperties: ƒ (action, options)

Description

-

getAllResultsOfRun: ƒ (runId)

Description

Fetches all test run results. OBSOLETE

getContext: ƒ (options)

Description

Used to retrieve the context of a control that is selected while recording. Returns an array of DOM elements.

getControlValue: ƒ (vt, $el)

Description

A helper function that retrieves values of the selected HTML control. Used during recording.

Options

vt : the vaue type, either “text”  to fetch the HTML control its JQuery text() value.

innerText to fetch the DOM innerText() value.

val  to fetch values using JQuery .val()

$el : the HTML element, can be retrieved using JQuery. fetched internally using the.findControl() function.

Example

Fetches the .val of the HTML element with id #user:

$.udb.benchmark.rec.getControlValue("val",$("#user"));

getCurrentAction: ƒ ()

Description

Retrieves the current recorded action. Returns -1 if there is none.

getCustomValueType: ƒ ($el)

Description

Retrieves the Web benchmark control its “Value type” property. More about the Value type property is found here.

getInvokes: ƒ (test, depth)

Description

Fetches all invokes that belong to the currently selected test, including nested invokes. Returns a udbPromise object.

Example

This example retrieves all invokes.

$.udb.benchmark.rec.getInvokes().then(function(res){console.log(res);return res});

This example displays an array of multiple objects.

[{"test": "Test 3"},{"test": "Test DB"},{"test": "Test DB2"}]

getOccurrence: ƒ ($elem, context)

Description

Retrieves the Occurence rank of a control. More about the Occurence Rank property is found here.

getPropertiesForElement: ƒ ($e, event)

Description

Retrieves all Web Benchmark properties of an element. Called when e.g. replacing a control.

Options

$e : 

ExampleThis example retrieves all properties of some tab named Documents on a click event:

$.udb.benchmark.rec.getPropertiesForElement($("#tabDocuments > a"),"click")

getScriptResult: ƒ (script, frame, waitPromise)

Description

Retrieves the result of a script action. Called when recording a script action. More about recording scripts can be found here.

getUniqueID: ƒ (name)

Description

Helper function for finding test control ID’s. Called by $.udb.benchmark.rec.setTestReferencesInElement()

getVariableValue: ƒ (origValue, requestedType)

Description

Parses and retrieves variables that are used in test actions. Used when you record a variable using $.udb.benchmark.rec.recordVariable()

$.udb.benchmark.rec.findControl() 

Also called during test playback.

invoke: false

Description

Internal flag used to skip notifications on invoked tests.

 

Description

Checks whether the action its control properties fetched via getActionControlproperties() has identical properties as

the last recorded change action fetched via getAction()

 

The check is done in order to check if the same control was recorded.

 

makeXML: ƒ (options)

Description

Generates the XML content when exporting to file.

Returns a udbPromise object. 

OptionsThe options are the same as $.udb.benchmark.events.export
Example

Generate XML for test named “test 1”:

await $.udb.benchmark.rec.makeXML({target:null,list:["test 1"],singleton:false,mode:"test",runList:[]}).then(function(s){console.log(s);return s});

 

The example uses await to get the value fullfilled by the udbPromise.

messageFilter: []

Description

Retrieves the list of messageFilters of extensions. For more details on message filters, please visit the following article. [Deprecated.]

Example

This example display the “Developer info” dialog in a web UI:

$.udb.benchmark.trigger(“dev.view”);

messages: []

Description

Array appended with recorded messages when triggering $.udb.benchmark.events.recordmessage .

mode: null

Description

Initialization flag used to test the mode of Web benchmark.

newTest: false

Description

Flag to check if the recorded test is a new test. Set as soon as the recording has stopped.

origSettings: 

Description

Internally used object, the same object as $.udb.benchmark.rec.settings

parameters: []

Description

Contains invocation parameters of the selected test.

parseTestFromXML: ƒ ($test, version)

Description

Called by $.udb.benchmark.rec.readXML  , after you imported from file.

propsList:

Description

Static object containing default properties that are used by the recorder engine for referencing purposes.

purgeRunsOfTest: ƒ (suiteName, testName, runList)

Description

Performs a delete of test runs. Called as soon as you trigger $.udb.benchmark.events.purge

readXML: ƒ (xml, struc)

Description

Reads the content of an XML file. Called as soon as you Import from file when you trigger $.udb.benchmark.events.load

recordComment: ƒ (comment)

Description

Record a comment as test action. Called automatically when you resume a paused recording where it adds a comment to your test.

ExampleThis example shows a call that automatically adds comment when resuming a recording.

$.udb.benchmark.rec.recordComment($.udb.benchmark.formatString("resume.record.message", [$.udb.data.date.format(new Date(), "DD-MM-YYYY HH24:MI:SS")], true));

recordVariable: ƒ ()

Description

Opens up the Record variable dialog allowing you to define variables. This function is called when you press the Variables button and then “Define variables”.

recordedActions: []

Description

Contains all actions belonging to the selected test.

replaceAllVariableValues: ƒ (value)

Description

Used during playback in order to do variable replacement

requestInvocationParams: ƒ (testObj, callback, current)

Description

Used at the moment a test is played in order to retrieve all invocation parameters

selectedRecId: 

Description

The selected test, its test ID number.

setValueFromVariable: ƒ (rec, show)

Description

Sets the HTML control its value.

setVariableActionsOfInvoke: ƒ (rec, defParams)

Description

Sets the invocation parameters on an invoke test action during playback based on the parameter type, which is either to set new values, inherit or to use the invocation parameter defaults. 

startEvent: ƒ ()

Description

Called when recording of a single action has started. succeeded by finishEvent() to indicate that the record of the step is finished.

started: false

Description

Flag that sets to true the moment you press the record button. Only sets to false when the stop event is fired (the stop or pause button is pressed).

storeTestRun: ƒ (run, testObj, suite)

Description

Stores the test run into either indexeddb or browser storage depending on $.udb.benchmark.settings.pushStorage.

storeValueInVariable: ƒ (rec, show)

Description

Called whenever you press the “Store Value or property in Variable” button to store values into variables.

storedMessages: []

Description

Temporary array containing messages belonging to a testrun.

validateControl: ƒ (rec, props)

Description

When using a replace control ,this function checks whether the newly set control is compatible with the action being edited. Reason can be that buttons do not support setValue, test can only be done on static (div) structures, asserts require input controls, etc. If the control is invalid, it will display a message.

variables:

Description

Temporarily filled with the variables used in a selected testrun. Cleared as soon as playback is finished.

Example

This example displays the “Developer info” dialog in GUI:

$.udb.benchmark.trigger(“dev.view”);

waits: []

Description

Contains all wait condition functions that are defined in the Manage Extensions window.