UiPath Documentation
activities
latest
false
Workflow activities
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

VerifyRange

Verifies if an expression is located or not within a given range.

Verifies if an expression is located or not within a given range.

Definition​

Namespace: UiPath.Testing.API

Assembly: UiPath.Testing.Activities.Api (in UiPath.Testing.Activities.Api.dll)

Overloads​

VerifyRange(object,VerificationType, object, string)Verifies if an expression is located or not within a given range.
VerifyRange(object,VerificationType, object, object,``string, bool, string, bool, bool)Verifies if an expression is located or not within a given range. You can also perform other configurations additional to the verification, such as configuring an output message format, or taking a screenshot in case the assertion fails.

VerifyRange(object,VerificationType, object, string)​

Verifies if an expression is located or not within a given range.

bool VerifyRange(
    Object expression,
    VerificationType verificationType,
    Object lowerLimit,
    Object upperLimit
)
bool VerifyRange(
    Object expression,
    VerificationType verificationType,
    Object lowerLimit,
    Object upperLimit
)

expression Object : The expression that you want to verify within a given range.

verificationType VerificationType : Select the verification type - inside or outside the range:

  • IsWithin
  • IsNotWithin

lowerLimit Object : The lower bound of the range.

upperLimit Object : The upper bound of the range.

outputMessageFormat String : Format of output message. The supported arguments are:

  • {Expression}
  • {ExpressionText}
  • {Operator}
  • {LowerLimit}
  • {LowerLimitText}
  • {UpperLimit}
  • {UpperLimitText}
  • {Result}

For more information, check the Configuring the outputMessageFormat section.

VerifyRange(Object,VerificationType, Object, Object,``String, Boolean, String, Boolean, Boolean)​

Verifies if an expression is located or not within a given range.You can also perform other configurations additional to the verification, such as configuring an output message format, or taking a screenshot in case the assertion fails.

bool VerifyRange(
    Object expression,
    VerificationType verificationType,
    Object lowerLimit,
    Object upperLimit,
    string outputMessageFormat,
    bool continueOnFailure,
    string alternativeVerificationTitle,
    bool takeScreenshotInCaseOfFailingAssertion,
    bool takeScreenshotInCaseOfSucceedingAssertion
)
bool VerifyRange(
    Object expression,
    VerificationType verificationType,
    Object lowerLimit,
    Object upperLimit,
    string outputMessageFormat,
    bool continueOnFailure,
    string alternativeVerificationTitle,
    bool takeScreenshotInCaseOfFailingAssertion,
    bool takeScreenshotInCaseOfSucceedingAssertion
)

expression Object : The expression that you want to verify within a given range.

verificationType VerificationType : Select the verification type - inside or outside the range:

  • IsWithin
  • IsNotWithin

lowerLimit Object : The lower bound of the range.

upperLimit Object : The upper bound of the range.

outputMessageFormat String : Format of output message. The supported arguments are:

  • {Expression}
  • {ExpressionText}
  • {Operator}
  • {LowerLimit}
  • {LowerLimitText}
  • {UpperLimit}
  • {UpperLimitText}
  • {Result}

For more information, check the Configuring the outputMessageFormat section.

continueOnFailure Boolean : Specifies if the automation should continue even when the activity throws an error. The default value is False. As a result, if the field is blank and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.

alternativeVerificationTitle String : This will be displayed in orchestrator.

takeScreenshotInCaseOfFailingAssertion Boolean : If set to True, takes a screenshot of the target process if the verification has failed.

takeScreenshotInCaseOfSucceedingAssertion Boolean : If set to True, takes a screenshot of the target process if the verification has been successful.

Return value​

It is “True” if the Verification passed/succeeded, and “False” if the Verification failed.

Configuring the outputMessageFormat​

The outputMessageFormat parameter can be configured with supported arguments, that act as placeholders for the values used in the verification operation. These placeholders are automatically populated with the variables or values defined when invoking the coded automation API at runtime.

For the VerifyRange coded automation API, you can implement the following supported arguments when creating an output message:

  • {Expression}: Represents the value of the expression you provided for the expression parameter.
  • {ExpressionText}: Represents the text of the expression you inserted for the expression parameter.
  • {Operator}: Corresponds to the verificationType parameter.
  • {LowerLimit}: Indicates the variable name you used for the lowerLimit parameter.
  • {LowerLimitText}: Refers to the textual representation of the variable used for the lowerLimit parameter.
  • {UpperLimit}: Represents the variable name used for the upperLimit parameter.
  • {UpperLimitText}: Points to the textual value of the variable used for the upperLimit parameter.
  • {Result}: Represents the coded automation API's return value, which is the verification result.

The following is an example on how to use the VerifyRange coded automation API, which includes configuring the outputMessageFormat parameter:

// Initialize a variable for the expression to be verified
var Expression1 = 23;

// Employ the VerifyRange coded automation API, with the last string parameter being the outputMessageFormat
testing.VerifyRange(Expression1, VerificationType.IsWithin, 1, 25, "The {Expression} should be greater than {LowerLimitText}, and less than {UpperLimitText}");
// Initialize a variable for the expression to be verified
var Expression1 = 23;

// Employ the VerifyRange coded automation API, with the last string parameter being the outputMessageFormat
testing.VerifyRange(Expression1, VerificationType.IsWithin, 1, 25, "The {Expression} should be greater than {LowerLimitText}, and less than {UpperLimitText}");

In the provided example, the placeholders within the curly brackets are replaced with the corresponding variable names and their values at runtime, providing a customized output message.

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新