Share this page

# lr.value_check

Informational Functions

Checks the value of a parameter.

Syntax 1

    Boolean lr.value_check ( <type> variable, <type> value, expression );

Syntax 2

    Boolean lr.value_check ( Object obj, String value, expression );

## Arguments

Name | Comments
--- | ---
variable | The unknown value to evaluate. Can be String, int, byte, char, double, float, long, short, or Boolean.
obj | Serializable object to evaluate.
value | The value or string for comparison. The type must be the same as the variable type.
expression | An expression: lr.EQUALS or lr.NOT_EQUALS.

The lr.value_check function checks the actual value of the parameter, variable, or a member of an object, obj, against the value that you pass to the function, value. Use expression to form the comparison clause, either equal or not equal. If the clause is not true, an exception occurs and an error message is issued to the Output window.

## The Object Parameter

When passing an object, obj, to evaluate, lr.value_check will not compare the entire object. Only members specified in the value argument will be validated. value include the member type, name and value, in the following format:

"member_type name = value"

To search and compare multiple members within the same lr.value_check method, the following format for value is used:

`"member_type name = value + member_type2 name2 = value2"`

Note: Members of type java.lang.String must use a '#' delimiter in the following format:
"java.lang.String myString = #myValue# + int myInteger = 4"

Multiple lr.value_check methods can be used for advanced verification. Where applicable, package and imports are not considered and full specification of the member type is required.

## Return Values

Returns a Boolean value.

## Parameterization

Standard parameterization is not available for this function.

## Example

In the following example, the carmel.buyTomatoes method returns an integer. The lr.value_check function checks if it equals 500.

         _int1 = _carmel.buyTomatoes((int)20);
         lr.value_check(_int1, 500, lr.EQUALS);

If you want to check if the method does not return a certain value, modify the code as follows:

         _int1 = _carmel.buyTomatoes((int)20);
         lr.value_check(_int1, 10, lr.NOT_EQUALS);

During replay, the expected value was not detected. An exception occurred and the following information was logged in the Output window.

`System.err: java.lang.Exception: lr.value_check failed.[Expected:500 Actual:5000]`

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: