Skip to content
/ .. / .. /
Range Rules





Range Rules

These rules verify that:

  • Range Rule - The ticket value's property falls between two specified values

  • Dynamic Range Rule - The ticket target's property falls within a specified range from the target, and allows for scaling.

  • Percentage Range Rule - This rule verifies that a property's value is within a certain percentage of its target.

Range Rule

Verifies that the ticket value's property falls between two specified values. When dates are compared to a number, the dates will be converted to Epoch milliseconds.

Note: This check is case sensitive.

Syntax

1
2
check <property String> between <minimum Date|Number|String> and <maximum Date|Number|String>;
check <property String> between <minimum Date|Number|String> and <maximum Date|Number|String> if present;
Parameters

  • property - The property being checked. The property should be resolved to a Date, Number or String.

  • minimum - The lowest value (inclusive) that the property may have. If the ticket's property value is empty, the test case will fail.

  • maximum - The highest value (inclusive) that the property may have. If the ticket's property value is empty, the test case will fail.

Example

1
2
3
4
5
6
7
8
check "RECORD_LENGTH" between 100 and 400;
check "RECORD_LENGTH" between 100 and 400 if present;

check "RECORD_LENGTH" between 100 and ${testcase.duration};
check "RECORD_LENGTH" between 100 and ${testcase.duration} if present;

check "RECORD_LENGTH" between "ABC" and "DEF";
check "RECORD_LENGTH" between "ABC" and "DEF" if present;

Additional Examples

Property Value Minimum Value Maximum Value Check Result
100 90 120 OK
100 90 99 FAIL
100 100 120 OK
100 ${90+9} 101 OK
3 1 ${1+1} FAIL
 4 -2  ${2+2} OK 
4  -2   ${5-3} FAIL 
"adz" "abc" "bcd" OK 
"cde" "abc" "bcd" FAIL

Dynamic Range

Verifies the ticket target's property falls within a specified range from the target, and allows for scaling.

Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// with no scaling
check <property String> within <delta Number|String> from <target Number|String>;
check <property String> within <delta Number|String> from <target Number|String> if present;

// with target scaled  
check <property String> within <delta Number|String> from <target Number|String> scaled by <targetScale Number|String>;
check <property String> within <delta Number|String> from <target Number|String> scaled by <targetScale Number|String> if present;

// with property scaled
check <property String> scaled by <propertyScale Number|String> within <delta Number|String> from <target Number|String>;
check <property String> scaled by <propertyScale Number|String> within <delta Number|String> from <target Number|String> if present;

// with property and target scaled
check <property String> scaled by <propertyScale Number|String> within <delta Number|String> from <target Number|String> scaled by <targetScale Number|String>;
check <property String> scaled by <propertyScale Number|String> within <delta Number|String> from <target Number|String> scaled by <targetScale Number|String> if present;

Parameters

  • property - The property being checked. The property should resolve to a Number or a String representation of a Number.

  • propertyScale (Optional) - The scale applied to property. Must be a Number or a String representation of a Number.

  • delta - The range in both positive and negative directions from the target that the property must fall between. Must be a Number or a String representation of a Number.

  • target - The value that the the property should match or fall within a range of. Must be a Number or a String representation of a Number.

  • targetScale (Optional) - The scale applied to target. Must be a Number or a String representation of a Number.

Example

1
2
check "CALL_DURATION" within 100 from 200;
check "CALL_DURATION" within 100 from 200 if present;
In the example above, the rule checks that "CALL_DURATION" falls within 100 from 200. i.e., the target must be between 100 and 300 inclusive.

Example With Scaling

1
2
check "CALL_DURATION" scaled by 2 within 100 from ${testcase.duration};
check "CALL_DURATION" scaled by 2 within 100 from ${testcase.duration} if present;
In the example above, the rule checks that "CALL_DURATION"'s target scaled by 2 falls within 100 from ${testcase.duration}.

Additional Examples

Property Value Property Scale Delta Target Target Scale Result
100 10 205 FAIL
100 2 5 205 OK
100 2 5 206 FAIL
100 10 0.01 10000 OK
100 2 10 20 10 OK

Percentage Range

Verifies that a property's value is within a certain percentage of its target.

Syntax

1
2
check <property String> is within <percentage Number>% of <target Number|String>;
check <property String> is within <percentage Number>% of <target Number|String> if present;

Parameters

  • property - The property being checked. The property should resolve to a Number or a String representation of a Number.

  • percentage - The percentage (exclusive) between 0 and 100 from the target that the property's value must fall between. The property should resolve to a Number or a String representation of a Number.

  • target - The value that the property should fall within a specified percentage of. The property should resolve to a Number or a String representation of a Number.

Example

1
2
check "CALL_DURATION" is within 50% of 200;
check "CALL_DURATION" is within 50% of 200 if present;
The example above checks that "CALL_DURATION"'s value is within 100 (50%) of 200.

Additional Examples

Property Value Percentage Target Result
100 50 200 OK
30 70 100 OK
29 70 100 FAIL
60 ${40+10} 100 OK