Vitaq Library Methods for Test Actions
This is a list of all the Vitaq library methods that can be used with Test Actions in the webdriverIO Test Action Scripts. To reference the Start Action (the green dot in the Test Activity diagram) in methods that use an action name, use the name 'top'.
clearCallCount
Every time an action is called the call count is incremented. When the call count reaches the call limit the action is not available to be called again. This method will reset the call count back to zero during the current seed test run. Very useful if you want to dynamically control how many times Vitaq can execute an action during a run.
await vitaq.clearCallCount("Action2")
Clears the call count for the Test Action named "Action2".
createVitaqLogEntry
(Short alias: 'log')
This will print a log into the Vitaq Test Activity Operations window which can be viewed in the Tab window next to the Sequences window and also in the log file of a webdriverIO run. Please note that only one text argument is allowed.
Example of how to use this method in a Vitaq Test Action Script:
await vitaq.createVitaqLogEntry("This is a text message being printed into the log")
OR
await vitaq.log("This is a text message being printed into the log")
getCallCount
Every time an action is called the call count is incremented. When the call count reaches the call limit the action is not available to be called again. This method will get the current call count of a particular Test Action.
await vitaq.getCallCount("expenseAction")
getCallLimit
Every time an action is called the call count is incremented. When the call count reaches the call limit the action is not available to be called again. This method will get the current call limit of a particular Test Action.
await vitaq.getCallLimit("expenseAction")
getEnabled
Any action in the Test Activity diagram can be enabled or disabled using the Test Action properties. However, actions can also be enabled/disabled through the test script. This is useful to control the test depending on what has happened in the test so far. This method will get the "enabled" status of a particular Test Action.
await vitaq.getEnabled("expenseAction")
getPrevious
getPrevious will return the name of the test Action that was run before the named Test Action. The second argument defines the number of Test Actions to go back, so 1 indicates the previous Test Action, 2 indicates the Test Action before that, etc.
Example of how to use this method in Vitaq Test Action Script:
await vitaq.getPrevious("logOut", 1)
This will get the previous test action in the sequence before the test action called "logOut". It returns a text string, so you can use it in a conditional to change test script behaviour depending on where the sequence has come from.
getSeed
This method will return the seed value used as the initial seed for the specified Test Action. To get the starting seed used to start the test, that is the seed that is specified for the green Start Action, you should specify the name of the action as 'top'.
Example of how to use this method in Vitaq Test Action Script:
// Get the seed value for the Test Action called "expenseAction"
console.log('The seed value for expenseAction is: ', await vitaq.getSeed("expenseAction"))
// Get the seed value for the Start Test Action
console.log('The seed value for this test run is: ', await vitaq.getSeed("top"))
log
Short alias of: 'createVitaqLogEntry'
setCallLimit
Every time an action is called the call count is incremented. When the call count reaches the call limit the action is not available to be called again. This method will set the call limit of a particular Test Action. This could be used for example to add a random number of items to a shopping cart, by calling an action which adds an item to a cart until the limit is reached, then the action is not called again.
await vitaq.setCallLimit("expenseAction")
setEnabled
Any action in the Test Activity diagram can be enabled or disabled using the Test Action properties. However, actions can also be enabled/disabled through the test script. This is useful to control the test depending on what has happened in the test so far. This method will set the "enabled" status of a particular Test Action, the second argument indicates if the action should be enabled or disabled.
await vitaq.setEnabled("expenseAction", false)
setExhaustive
This method will set the "exhaustive" status of a particular Test Action, the second argument indicates if the action should be exhaustive or not. For more details about the use of "exhaustive" actions see the section on Exhaustive Test Actions.
await vitaq.setExhaustive("expenseAction", true)
setMaxActionDepth
This method will set the "max depth" of a particular Test Action, the second argument indicates the maximum depth. For more details about the use of "max depth" see the section on Max Depth.
await vitaq.setMaxActionDepth("expenseAction", 5)