Compare Inputs
This is a pre-built Action located under the @Generic Element. The functionality of this Action in Avo Assure is to compare the input values and store the identified differences in a dynamic variable.
Syntax
Input Value: <Input(Original)>;<Input(Changed)>;<Selective/All(Optional)>
<Input Text (Original)>
(Required)
Provide the original input text or file that needs to be compared.
<Input Text (Changed)> (Required)
Provide the updated or modified input text or file to compare with the original text.
<Selective/All(Optional)>
Provide Selective to compare specific changes or All to compare all input changes.
Output Value: <Dynamic Variable>;<Dynamic Variable>(`Optional)
<Dynamic Variable> (Required)
This dynamic variable holds the result of the content comparison.
<Dynamic Variable> (Optional)
This dynamic variable stores the status as True or False.
Example 1: Comparing Two JSON Files
In this example, we explain how to compare the content of two JSON files.
Action: Compare Inputs
Input Value: C:\TestData\Request.json;C:\TestData\ExpectedRequest.json
The first argument (C:\TestData\Request.json) specifies the original JSON file.
The second argument (C:\TestData\ExpectedRequest.json) specifies the JSON file to compare.
Output Value: {ComparisonResult}
The first output variable ({ComparisonResult}) stores the comparison result.
If a second output variable is provided, the action returns the status as True or False:
True: If the comparison executes successfully.
False: If the comparison fails due to invalid file path, missing file, or unsupported format.
Logical Explanation: The Compare Inputs action takes the values from the Input Value column (C:\TestData\Request.json;C:\TestData\ExpectedRequest.json) and compares both JSON files. The action validates the file content, structure, missing fields, additional fields, and value differences. The comparison result is stored in the {ComparisonResult} variable.

Example 2: Comparing an XML File with Static Input
In this example, we explain how to compare an XML file with static input content.
Action: Compare Inputs
Input Value: C:\Users\Downloads\Test.xml;<xml_input>
The first argument (C:\Users\Downloads\Test.xml) specifies the XML file to compare.
The second argument (<xml_input>) specifies the static XML input content.
Output Value: {ComparisonResult}
The first output variable ({ComparisonResult}) stores the comparison result.
If a second output variable is provided, the action returns the status as True or False:
True: If the comparison executes successfully.
False: If the comparison fails due to invalid file path, missing file, or unsupported format.
Logical Explanation: The Compare Inputs action takes the values from the Input Value column (C:\Users\Downloads\Test.xml;<xml_input>) and compares the XML file content with the provided static input. The action validates the structure, content, missing tags, and mismatched values. The comparison result is stored in the {ComparisonResult} variable.


Example 3: Comparing Inputs Using Selective Comparison
In this example, we explain how to compare only the modified content between two inputs using Selective comparison.
Action: Compare Inputs
Input Value: {"Name":"John","Age":25,"City":"Mumbai"};{"Name":"John","Age":28,"City":"Mumbai"};Selective
The first argument ({"Name":"John","Age":25,"City":"Mumbai"}) specifies the original input content.
The second argument ({"Name":"John","Age":28,"City":"Mumbai"}) specifies the changed input content to compare.
The third argument (Selective) specifies that the action compares only the modified content instead of the complete structure.
Output Value: {ComparisonResult};{Status}
The first output variable ({ComparisonResult}) stores the comparison result.
The second output variable ({Status}) stores the execution result with the following possible values:
True: If the comparison executes successfully.
False: If the comparison fails due to invalid input, missing values, or unsupported format.
Logical Explanation: The Compare Inputs action takes the values from the Input Value column ({"Name":"John","Age":25,"City":"Mumbai"};{"Name":"John","Age":28,"City":"Mumbai"};Selective) and compares only the modified content between both inputs. In this example, the action identifies that the Age value changes from 25 to 28 while the remaining content stays unchanged. The comparison result is stored in the {ComparisonResult} variable as (
- {"Name":"John","Age":25,"City":"Mumbai"} ? ^
+ {"Name":"John","Age":28,"City":"Mumbai"} ? ^
).

Last updated