Skip to main content

Vitaq Library Methods for Test Data

This is a list of all of the Vitaq library methods that can be used with Activity Variables in the webdriverIO Test Action Scripts.

allowList#

Allow a new list item declared in the arguments of this method when generating a value for the declared Vitaq Test Activity Variable.

This Vitaq library method will remove all existing constraints applied up to this point.

Example of how to use this method in Vitaq Test Action Script:

For a list in the Activity Variables Tab called userNames of type list extend the allowable list to be add locked_out_user

await vitaq.allowList("userNames", ['locked_out_user'])
await vitaq.gen("userNames")

allowOnlyList#

Allow only the list declared in the arguments of this method when generating a value for the declared Vitaq Test Activity Variable.

This Vitaq library method will remove all existing constraints applied up to this point and allow only the list supplied.

Example of how to use this method in Vitaq Test Action Script:

For a list in the Activity Variables Tab called userNames of type list redefine the allowable list to be standard_user and problem_user

await vitaq.allowOnlyList("userNames", ['standard_user', 'problem_user'])
await vitaq.gen("userNames")

allowOnlyRange#

Allow only the passed range of values into the allowable ranges for this variable.

This Vitaq library method will remove all existing constraints applied up to this point and allow only the range of values supplied.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed of type integer redefine the allowable range of values for Speed to be in the range of 30 to 50

await vitaq.allowOnlyRange("Speed", [30, 50])
await vitaq.gen("Speed")

allowOnlyValue#

Allow only the supplied value as an allowable value for this Vitaq Activity variable.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed of type integer redefine the only allowable value for Speed to 70

await vitaq.allowOnlyValue("Speed", 70)
await vitaq.gen("Speed")

allowRange#

Allow a range of values as allowable values for this Vitaq Activity variable.

Allow a range of values to be included in the set of values that may be selected by the Vitaq generator.

This effect of this Vitaq library method is cumulative. Thus repeated called to allowRange() will have the effect of increasing the number of allowable values that may be selected by the generator.

By default all possible values for a given type are allowable and therefore performing allowRange() as an initial constraint will have no effect. If the desired effect is to allow only this range and thereby remove all other values then the allowOnlyRange() member method should be used.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed with range 30 to 70 of type integer extend the only values for Speed up to 90

await vitaq.allowRange("Speed", [71, 90])
await vitaq.gen("Speed")

allowValue#

Allow a value into the allowable ranges of values for this Vitaq Activity variable.

Allow a value to be included in the set of values that may be selected by the Vitaq generator.

This effect of this Vitaq library method is cumulative. Thus repeated called to allowValue() will have the effect of increasing the number of allowable values that may be selected by the generator.

By default all possible values for a given type are allowable and therefore performing allowValue() as an initial constraint will have no effect. If the desired effect is to allow only this range and thereby remove all other values then the allowOnlyValue() member method should be used.

Example of how to use this method in Vitaq Test Action Scripts:

For a variable defined in the Activity Variables Tab as Speed with range 30 to 70 of type integer extend to allow one additional outlier value for Speed of 90.

await vitaq.allowValue("Speed", 90)
await vitaq.gen("Speed")

allowValues#

Allow values into the allowable ranges of values for this Vitaq Activity variable.

Allow values to be included in the set of values that may be selected by the Vitaq generator.

This effect of this Vitaq library method is cumulative. Thus repeated called to allowValues() will have the effect of increasing the number of allowable values that may be selected by the generator.

By default all possible values for a given type are allowable and therefore performing allowValues() as an initial constraint will have no effect. If the desired effect is to allow only this range and thereby remove all other values then the allowOnlyValues() member method should be used.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed with range 30 to 70 of type integer extend to allow two additional ‘outlier’ values for Speed of 90 and 100`

await vitaq.allowValues("Speed", [90, 100])
await vitaq.gen("Speed")

disallowRange#

Disallow a range values from the allowable ranges for this Vitaq Activity variable.

Disallow a range of values from being included in the set of values that may be selected by the Vitaq generator.

Each time the disallowRanges() Vitaq library method is called, the disallowed range of values is removed from the set of allowable values. The effect is cumulative and reduces the list of allowable values.

Note: Disallowed ranges may overlap with previously disallowed ranges.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed with range 30 to 70 of type integer will be reduced to values for Speed of 30 to 50

await vitaq.disallowRange("Speed", 51, 70)
await vitaq.gen("Speed")

disallowValue#

Disallow a value from the allowable ranges for this Vitaq Activity variable.

Disallow a particular of value from being included in the set of values that may be selected by the Vitaq generator.

Each time the disallowValue() Vitaq library method is called, the disallowed value is removed from the set of allowable values. The effect is cumulative and reduces the list of allowable values.

Note: If a value is removed using disallow_value() which is already excluded from the allowed set of values the excluded set remains unchanged.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed with range 30 to 90 of type integer will be reduced to values for Speed of 30 to 89

await vitaq.disallowValue("Speed", 90);
await vitaq.gen("Speed")

disallowValues#

Disallow a list of values from the allowable ranges for this Vitaq Activity variable.

Disallow a list of values from being included in the set of values that may be selected by the Vitaq generator.

Each time the disallowValues() Vitaq library method is called, the disallowed values are removed from the set of allowable values. The effect is cumulative and reduces the list of allowable values.

Note: If a value is removed using disallowValues() which are already excluded from the allowed set of values the excluded set remains unchanged.

Example of how to use this method in Vitaq Test Action Script:

For a variable defined in the Activity Variables Tab as Speed with range 30 to 90 of type integer will be reduced to values for Speed of 30 to 69 and 71 to 89.

await vitaq.disallowValues("Speed", [70, 90])
await vitaq.gen("Speed")

doNotRepeat#

Set this field to not reuse values.

For example if we a Test Activity Variable called listOfNames, with a list of names such as Bill,Bob,Claire,Karen,Monty,Pilaty,Seamus. By default a Activity Variable generation vitaq.gen() method can select any value on each and every generation cycle. By setting doNotRepeat(), each time a value is generated then that value will be removed from the list of allowable values. This means that the same value will not be selected twice.

await vitaq.doNotRepeat("listOfNames")
await vitaq.gen("Speed")

Warning: Be careful when using doNotRepeat in AI mode. The AI machine learning will determine what next data to select to achieve the coverage goals. So you need to make sure you put the await vitaq.recordCoverage("listOfNames") directly after you have requested (generated) the new data, so it can be used in the AI machine learning algorithm.

Note: After enough generation cycles have been executed then all of the available values may be exhausted. Trying to generate when there are no available values to select will cause an exception. The user should take care of resetting the constraints if this might be a problem in their Test Activity. Note: You can also turn off the doNotRepeat on a test activity variable by using:

await vitaq.doNotRepeat("listOfNames", false)
await vitaq.doNotRepeat("listOfNames")
await vitaq.gen("Speed")

Warning: This method is only valid with a given seed. As soon as you start a new Vitaq run with a new seed value, then Vitaq will clear all methods and start from setUp again.

gen#

This Vitaq library method will generate new values for Vitaq Activity Variables when called in a Test Action Script.

Example of how to use this method in Vitaq Test Action Script: This will generate a new value for all Vitaq Activity Variables defined in the Activity Variable tab.

await vitaq.gen()

This will generate a new value for a specific named Vitaq Activity Variable (i.e. expenseValue) which is already defined in the Activity Variable tab.

await vitaq.gen("expenseValue")

getValue


This Vitaq library method will get the current values for Vitaq Activity Variables when called in a Test Action Script.

Example of how to use this method in Vitaq Test Action Script:

await vitaq.getValue("expenseValue")

This will get a value for a specific named Vitaq Activity Variable (i.e. expenseValue) which is already defined in the Activity Variable tab.

log#

This will print a Console.log into the Vitaq Test Activity log window which can be viewed in the Tab window next to the Script Output window and also in the log file.

Example of how to use this method in Vitaq Test Action Script:

await await vitaq.log("This is a console.log message being printed into the Vitaq Test Activity log")

readDataFromVitaq#

In the example below the data generated from the Vitaq Test Activity Variable itemPrice can be read from Vitaq and passed directly to another spec Action code in webdriverIO.

Example of how to use this method in Vitaq Test Action Script:

await vitaq.readDataFromVitaq("itemPrice")

sendDataToVitaq#

In the example below the data generated from the Vitaq Test Activity Variable itemPrice can be sent to Vitaq and passed directly to another spec Action code in webdriverIO.

Example of how to use this method in Vitaq Test Action Script:

await vitaq.sendDataToVitaq("itemPrice", price)

recordCoverage#

To make sure that you monitor and measure your data functional coverage for Test Activity Variables into the coverage database, you need to use the recordCoverage() method in the Test Action script where you are asking Vitaq AI to automatically generate the data using the gen() method.

Example of how to use this method in Vitaq Test Action Script:

await vitaq.recordCoverage("newAccountTitle")

Here we are recording Functional Coverage for the Vitaq Test Activity Variable newAccountTitle.

Warning:

If you fail to record Coverage by not including the method in your script with the appropriate Test Activity Variable, you will not get > any Coverage measured for that variable and hence the Vitaq AI algorithms will not be able to achieve 100% Coverage.

Warning:

If you record Coverage for a Test Activity Variable before generating data using the gen method that Vitaq AI will error but continue informing that you have not yet generated any Data to measure coverage on.

requestData#

This Vitaq library method will generate vitaq.gen() and then return new values for Vitaq Activity Variables when called in a Test Action Script.

Example of how to use this method in Vitaq Test Action Script:

This will generate a new value for a specific named Vitaq Test Activity Variable (i.e. expenseValue) which is already defined in the Activity Variable tab.

await vitaq.requestData("expenseValue")

resetRanges#

Reset the defined ranges of a Test Activity Variable defined in the Activity Variables tab

await vitaq.resetRanges("expenseValue")