Compare Inputs
Last updated
Last updated
Description & Usage: This pre-built Action, found under the @Generic Element Name, directs the Avo Assure Client to compare specified inputs in .xml and .json formats. It saves the differences in the first output variable. The execution status will be stored in the second output variable as 'True' if successful, else the status will be False.
Input: <Input Text (Original)>;<Input Text(Changed)> <Selective/All(Optional)>
Output: <Dynamic Variable>;<Dynamic Variable>(Optional)
Note: Outputs for compare files and compare Inputs are as follows:
JSON and text:
- If a line is removed from the first input
+ If a line is added in the second input
? shows the delta (difference) of the two files
xml: \ tags will be there with the following params:
diff:update-attr – XML attribute is updated
diff:delete- line deleted
diff:insert- line inserted
diff:delete-attr- attribute deleted
diff:add-attr- XML attribute added
In a web application that allows user registration, input data is submitted in JSON format. It’s essential to ensure that the input values match expected values to maintain data integrity before creating a new user account.
Input: A user submits their registration information via an API request in JSON format. You want to compare this input against expected values to verify accuracy.
Input JSON:
json
{ "Name": "Alice Johnson",
"Email": "alice.johnson@example.com",
"Password": "securePass123"}
Expected JSON:
json
{ "Name": "Alice Johnson",
"Email": "alice.johnson@example.com",
"Password": "securePass123" }
Expected Result: The application should confirm that the values for Name, Email, and Password in the input JSON match the expected values.
Output: In the scenario described, the {result}
variable will store the differences in lines—either removed or added—between the compared files. The {status}
variable will hold a value of True
, which can be useful for display and use it for other purposes.
{result} variable will contain the result of removed/added lines between the compared files and {status} variable will contain status as ‘True’.