activities
latest
false
UiPath logo, featuring letters U and I in white
Workflow Activities
Last updated Nov 18, 2024

VerifyExpressionWithOperator

Verifies an expression by asserting it in relation to a given expression with an operator.

Definition

Namespace: UiPath.Testing.API

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

Overloads

OverloadDescription
VerifyExpressionWithOperator(object, Comparison, object, string)Verifies an expression by asserting it in relation to a given expression with an operator.
VerifyExpressionWithOperator(object, Comparison, object)string, bool, string, bool, bool)Verifies an expression by asserting it in relation to a given expression with an operator. 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.

VerifyExpressionWithOperator(object, Comparison, object, string)

Verifies an expression by asserting it in relation to a given expression with an operator.

bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression
       string outputMessageFormat = null
)bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression
       string outputMessageFormat = null
)
firstExpression Object
The first expression in the verification process.
operatorValue Comparison
Possible mathematical operators you want to use to verify the two expressions.
secondExpression Object
The second expression in the verification process.
outputMessageFormat String
The format of the output message. The supported arguments are:
  • {LeftExpression}
  • {LeftExpressionText}
  • {RightExpression}
  • {RightExpressionText}
  • {Result}
  • {Operator}

For more information, check the Configuring the outputMessageFormat section.

VerifyExpressionWithOperator(object, Comparison, object)string, bool, string, bool, bool)

Verifies an expression by asserting it in relation to a given expression with an operator. 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 VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression,
	string outputMessageFormat,
	bool continueOnFailure,
	string alternativeVerificationTitle,
	bool takeScreenshotInCaseOfFailingAssertion,
	bool takeScreenshotInCaseOfSucceedingAssertion
)bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression,
	string outputMessageFormat,
	bool continueOnFailure,
	string alternativeVerificationTitle,
	bool takeScreenshotInCaseOfFailingAssertion,
	bool takeScreenshotInCaseOfSucceedingAssertion
)
firstExpression Object
The first expression in the verification process.
operatorValue Comparison
Possible mathematical operators you want to use to verify the two expressions. Access the operators through the Comparison object. The following options are available:
  • Cotains
  • Equality
  • GreaterThan
  • GreaterThanOrEqual
  • Inequality
  • LessThan
  • LessThanOrEqual
  • RegexMatch
secondExpression Object
The second expression in the verification process.
outputMessageFormat String
Format of the output message. The supported arguments are:
  • {LeftExpression}
  • {LeftExpressionText}
  • {RightExpression}
  • {RightExpressionText}
  • {Result}
  • {Operator}

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 VerifyExpressionWithOperator API, you can implement the following supported arguments when creating an output message:

  • {LeftExpression}: Represents the value of the first expression you provided for the firstExpression parameter.
  • {LeftExpressionText}: Represents the text of the first expression you inserted for the firstExpression parameter.
  • {RightExpression}: Represents the value of the second expression you provided for the secondExpression parameter.
  • {RightExpressionText}: Represents the text of the second expression you inserted for the secondExpression parameter.
  • {Result}: Represents the API's return value, which is the verification result.
  • {Operator: Represents the operator used in the verification, set by the operatorValue parameter.
The following is an example on how to use the VerifyExpressionWithOperator 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 VerifyExpressionWithOperator API, with the last string parameter being the outputMessageFormat
testing.VerifyExpressionWithOperator(expression1, Comparison.Contains, expression2, "{LeftExpression} {Operator} the {RightExpression}, so the verification is {Result}.");// Initialize variables for the expressions to be verified
var expression1 = "User created succesfully";
var expression2 = "successfully created user";

// Employ the VerifyExpressionWithOperator API, with the last string parameter being the outputMessageFormat
testing.VerifyExpressionWithOperator(expression1, Comparison.Contains, expression2, "{LeftExpression} {Operator} the {RightExpression}, so the verification 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.