Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Phill1 Absent Member.
Absent Member.
3076 views

Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

Hi there,

Im using SilkTest Workbench (Visual) and trying to setup verification that evaluates text.

Unfortunately the Condition Designer offers only numerical or boolean operators..
How do I compare text in the designer - for example, how do I state Value 1 contains value 2 etc.

Thanks !

0 Likes
2 Solutions

Accepted Solutions
VictorO Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

Hi,

You can perform text comparison with the Expression Designer using the equals comparison (==) operator.

For example, assuming we have a local variable (myText as Text) in the Visual Test that stores the actual value to be verified as shown below:

We can also create an additional local variable (bEval as Boolean) that will store the result of the comparison as shown below:

We can then perform a text comparison in the Expression Designer editor as follows, storing the result of the comparison in the Boolean variable (bEval) as shown below.  The text in the Expression Designer editor in double quotes will be treated as the expected value.

Subsequently, we can use the resulting boolean value in the steps that follow the comparison in the Visual Test, in this example, we display the result in a message box.

The comparison result of the above Visual Test should be a failed comparison because the actual text (myText) contains a dot (.) at the end, whereas the expected text in the Expression Designer editor does not.

Note: The comparison using the Expression Designer checks for an exact match. If you wish to perform a comparison that checks if an expected text contains text from an actual value, you may consider performing this comparison in a VB.NET script which you can call in your Visual Test.

regards,

Victor

0 Likes
HGrube Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

I think it is not necessary to leave the Visual Test if want to find out if value2 is included in value1. You can use the "Find" function in the Expression Designer.

0 Likes
6 Replies
VictorO Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

Hi,

You can perform text comparison with the Expression Designer using the equals comparison (==) operator.

For example, assuming we have a local variable (myText as Text) in the Visual Test that stores the actual value to be verified as shown below:

We can also create an additional local variable (bEval as Boolean) that will store the result of the comparison as shown below:

We can then perform a text comparison in the Expression Designer editor as follows, storing the result of the comparison in the Boolean variable (bEval) as shown below.  The text in the Expression Designer editor in double quotes will be treated as the expected value.

Subsequently, we can use the resulting boolean value in the steps that follow the comparison in the Visual Test, in this example, we display the result in a message box.

The comparison result of the above Visual Test should be a failed comparison because the actual text (myText) contains a dot (.) at the end, whereas the expected text in the Expression Designer editor does not.

Note: The comparison using the Expression Designer checks for an exact match. If you wish to perform a comparison that checks if an expected text contains text from an actual value, you may consider performing this comparison in a VB.NET script which you can call in your Visual Test.

regards,

Victor

0 Likes
Phill1 Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

Hi Victor,

Thanks for the response.

Am I correct in assuming then that a verify step doesn't operate on text as well ?

0 Likes
HGrube Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

Kind regards

Holger

0 Likes
HGrube Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

I think it is not necessary to leave the Visual Test if want to find out if value2 is included in value1. You can use the "Find" function in the Expression Designer.

0 Likes
Highlighted
HGrube Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

0 Likes
HGrube Absent Member.
Absent Member.

RE: Text Comparisons with NUMERIC ? Operators in Visual Test Condition Designer

Jump to solution

Sorry, but in my first post with text, image and text only the last text has been uploaded...

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.