"COMPARE" Command

Description: This command compares values such as text, numbers, dates and images, etc. In order to make the comparison, you need to have the values stored in variables, data template fields and/or constant values.

Usage Scenarios:
1- Suppose we want to compare two images taken with Screen_Shot command which were collected from the Communities page on our Reference app.

Procedure: Create a step with Compare command to compare between both screenshot_1 and screenshot_2 variables with operator "Not_Equal”. Your step will look like this:

image-20240201-164431.png
image-20240201-164406.png

See the Test Library path: subject7_samples/subject7_intermediate_suite/subject7_existing_communities_screenshot

The following video demonstrates how a comparison between two screenshots is done as part of execution of “subject7_existing_communities_screenshot” test case in “subject7_samples” folder:

 

2- Suppose we want to compare two dates, one is retrieved from the last time the profile was updated (added in Resume section of the profile) and the other is from the current system time.

Procedure: Define your step to retrieve the date from Resume using Get_Web_Value command and compare it to the current system time (format needs to be the same). Your steps will look like this:

 

See the Test Library path: subject7_samples/subject7_advanced_suite/subject7_modify_profile_information


3- Suppose we want to compare the status variable from a REST response to 200 to make sure that the request was successful.

Procedure: Define a step that makes a request (getting profile information) and another step that compares the status variable to "200" to make sure it is successful. Your steps will look like this:

See the Test Library path: subject7_samples/subject7_intermediate_suite/subject7_get_profile_by_id_using_rest

The video following video demonstrates how a comparison between a returned status code and “200” happens as part of execution of “subject7_get_profile_by_id_using_rest” test case in “subject7_samples” folder. If the status code is not “200”, this means that step 9 (Get_REST_Value) retrieved a different status code in which case the comparison step will fail.