This topic provides information on selecting JSON elements in the JSON Assertor and JSON Data Bank tools inSOAtest.

 Sections include:

Changing Elements

For working with JSON and selecting nodes,SOAtest construct an XML DOM "under the hood" in order to use XPath for node selection. The XML structure very closely matches the JSON structure. All names and values are equivalent, except for the following cases:

When you select a JSON tree node,SOAtest also create a corresponding XPath. 

If you need to manually construct an XPath and you aren’t sure what node names to use in your XPath, we suggest that you use the JSON tree to select a node. This will cause an XPath to be generated that you can then review and modify to meet your specific needs.

Modifying Selected XPath Settings

The following options are available in the dialog that opens when you click Change Element (for JSON Assertor) or Modify (for JSON Data Bank).

Selected XPath Options

Data Source Column Options (Data Bank Only)


Parameterizing XPaths

You can parameterize XPaths to reference test or Responder suite variables, environment variables, and data source values. The syntax to reference variables is ${myVariableName}. The syntax to reference Data Bank values and Data Source Values is: ${myColumnName}

For example, if ${XPath Key} is a data source column name, you could use the following:

/*[local-name(.)="bookstore" and namespace-uri(.)=""]/*[local-name(.)="book" and namespace-uri(.)=""][child::node()[local-name(.)="title" and text()="${XPath Key}"]]]