activities
latest
false
UiPath logo, featuring letters U and I in white

Workflow Activities

Last updated Dec 20, 2024

VerifyExpression

Verifies the truth value of a given expression. An Expression must be supplied.

Definition

Namespace: UiPath.Testing.API

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

Overloads

  
VerifyExpression(bool)Verifies the truth of a given expression.
VerifyExpression(bool, string)Verifies if the truth of a given expression, while configuring the output format of the message.
VerifyExpression(bool, string, bool, string, bool, bool)Verifies the truth of a given expression, considering several configurations, such as a certain output message format, or an alternative verification title.

VerifyExpression(Boolean)

Verifies the truth of a given expression.

bool VerifyExpression(
	bool expression
)bool VerifyExpression(
	bool expression
)
expression Boolean
The expression that you want to verify

VerifyExpression(bool, string)

Verifies if the truth of a given expression, while configuring the output format of the message.

bool VerifyExpression (
    bool expression,
    string outputMessageFormat
)bool VerifyExpression (
    bool expression,
    string outputMessageFormat
)
expression Boolean
The expression that you want to verify
outputMessageFormat String
Format of output message. Supported arguments are the following:
  • {LeftExpression}
  • {Result}

VerifyExpression(Boolean, String, Boolean, String, Boolean, Boolean

Verifies the truth of a given expression, considering several configurations, such as a certain output message format, or an alternative verification title.

bool VerifyExpression(
	bool expression,
	string outputMessageFormat,
	bool continueOnFailure,
	string alternativeVerificationTitle,
	bool takeScreenshotInCaseOfFailingAssertion,
	bool takeScreenshotInCaseOfSucceedingAssertion
)bool VerifyExpression(
	bool expression,
	string outputMessageFormat,
	bool continueOnFailure,
	string alternativeVerificationTitle,
	bool takeScreenshotInCaseOfFailingAssertion,
	bool takeScreenshotInCaseOfSucceedingAssertion
)
expression Boolean
The expression that you want to verify.
outputMessageFormat String
Format of output message. Supported arguments are the following:
  • {LeftExpression}
  • {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 title 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 API at runtime.

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

  • {LeftExpression}: Represents the value of the expression you provided for the expression parameter.
  • {Result}: Represents the API's return value, which is the verification result.
The following is an example on how to use the VerifyExpression API, which includes configuring the outputMessageFormat parameter:
// Initialize variables for the expressions to be verified
var expression1 = "User created succesfully";
var expression2 = "successfully created user";

// Employ the VerifyExpression API, with the last string parameter being the outputMessageFormat
testing.VerifyExpression(expression1 == 23, "{LeftExpression} is {Result}");// Initialize variables for the expressions to be verified
var expression1 = "User created succesfully";
var expression2 = "successfully created user";

// Employ the VerifyExpression API, with the last string parameter being the outputMessageFormat
testing.VerifyExpression(expression1 == 23, "{LeftExpression} is {Result}");

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.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.