XML and JSON Operations
Last updated
Last updated
Description: This keyword or action instructs Avo Assure Client to fetch the number of blocks in the given input and save the result in the output variable.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
getBlockCount
<XML block/ JSON block>;<XML blockname/ JSON parentblockname1>.<parent_blocknameN (optional)>; <JSON parent_block1_index>,<JSON parent_blockn_index> (optional)
(Optional)
XML/JSON files
Text
Static values/ Dynamic variables
Find the snippet of the keyword below for JSON:
In the above example, after the test case debug, it fetches the number of blocks in the given input. It saves the result in the output variable {result}, and the execution status “True”/ “False” will be stored in the second output variable if provided.
Note: For JSON inputs, the block count of the block with a certain key-value pair can be fetched. Syntax: <JSON_block>; <parent_blockname>.<child_block/key_name>:<child_block/key_value>; <parent_blockindex>.<child_blockindex>
Find the snippet of the keyword below for JSON when fetching block count based on key-value pair match:
In the above example, after the test case debug, it fetches the number of blocks in the given input that match the criteria of the key ‘pin’ to have the value ‘560012’. It saves the result in the output variable {result}, and the execution status “True” / “False” will be stored in the second output variable, if provided.
Find the snippet of the keyword below for XML:
In the above example, after the test case debug, it fetches the number of blocks in the given input and saves the result in the output variable {A}. The execution status “True”/ “False” will be stored in the output variable.
Description: This keyword or action instructs Avo Assure Client to fetch the value of the XML block/tag specified by the user and save the result in the output variable.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
getBlockValue
<XML tag name>; <number of blocks to be fetched>; <block name>
{Variable}
Text
Static values/ Dynamic variables
Find the snippet of the keyword below for XML:
In the above example, after the test case debug, it fetches the value of the XML block. It saves the result in the output variable {B}, and the execution status “True”/ “False” will be stored in the variable {GetBlockValue}.
Description: This keyword or action instructs Avo Assure Client to fetch the tag value from the input provided by the user and save the result in the output variable.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
getTagValue
<XML block/ XML tags>; <number>; <block name>; <tag name>
{Variable}
Text
Static values/ Dynamic variables
Find the snippet of the keyword below for XML:
In the above example, after the test case debug, it fetches the value from the input provided. It saves the result in the output variable {C}, and the execution status “True”/ “False” will be stored in the variable {TagValue}.
Description: This keyword or action instructs Avo Assure Client to fetch the value of the specified key from the input provided by the user and save the result in the output variable.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
getKeyValue
<JSON block>; <parent_key1>.<parent_keyn> (optional); <parent_block1_index>, <parent_blockn_index> (optional), <key_count>; <key_name>
{Variable}
Text
Static values/ Dynamic variables
Find the snippet of the keyword below for JSON:
In the above example, after the test case debug, it fetches the key’s value from the input provided and saves the result in the output variable {getKeyValue}. In this example, {getKeyValue} will hold “Blueberry”.
Description: This keyword or action instructs Avo Assure Client to set the value of the specified key from the input provided by the user and save the result in the output variable.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
setKeyValue
<JSON block>;
<parent_key1>. <parent_keyn>; <parent_block1_index>, <parent_blockn_index>, <key_count>;<key_name>;<key_value>
{Variable}
Text
Static values
Dynamic variables
Find the snippet of the keyword below for JSON:
In the above example, after the test case debug, it sets the key’s value from the input provided and saves the result in the output variable {setKeyValue}. In this example, “Devils Food” will be replaced by “Heavens Food” and {setKeyValue} will hold the changed JSON.
Description: This keyword or action instructs Avo Assure Client to verify if 2 JSON files or 2 JSON data match or do not match.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
compareJsonContent
<File_path - Original File/Input Text (Original)>; <File_path - File to Compare/Input Text (Changed)>
{Variable}
JSON file path
JSON data
Static values/ Dynamic variables
Find the snippet of the keyword below:
In the above example, after the test case debug, the JSON files are compared, and the match result (True/ False) will be stored in the output variable {result}.
Description: This keyword or action instructs Avo Assure Client to fetch the block data based on the given block xpath.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
getXmlBlockData
<XML_file_path>;
<block_xpath>
{Variable}
XML file
Text
Static values/ Dynamic variables
Find the snippet of the keyword below:
In the above example, after the test case debug, it fetches the block data based on the block xpath given in the input and saves the result in the output variable {BlockData}.
Description: This keyword or action instructs Avo Assure Client to compare the block data with the XML file specified whose block xpath is provided.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
compXmlFileWithXmlBlock
<XML_File_path>;
<block Data from getXmlBlockData keyword>;
<block xpath in file provided>
{Variable}
XML file
Text
Static values/ Dynamic variables
Find the snippet of the keyword below:
In the above example, after the test case debug, it compares the block data provided by the getXmlBlockData keywords with the file based on its block xpath and stores the comparison result in the output variable {result}.
Description: This keyword or action instructs Avo Assure Client to use the specified block data (based on block xpath) and compare the block data between 2 XML files.
Keyword
Input Syntax
Output Syntax
Supported Input Formats
selectiveXmlFileCompare
<XML_file_path - Original File>; <XML_file_path - File to Compare>;<all/selective - output result (optional)>; <block xpath_in_file_
provided>
{Variable}
XML file
Text
Static values/ Dynamic variables
Find the snippet of the keyword below:
In the above example, after the test case debug, it compares the block data provided between the XML files and stores the comparison result in the output variable {result}.