This section contains information on XML automation.
The Extensible Markup Language (XML) is used for the creation of structured documents that are both human- and machine-readable. The content of a document is organized into meaningful elements that are wrapped in tags, similar in manner and appearance to HTML tags. XML tags may include attributes, which are annotations that convey additional meaning. In addition to conveying meaning, tags and attributes can ease the task of locating and manipulating portions of the document.
TestArchitect offers support for XML automation, allowing you to perform verification and comparison operations on XML data, store test data in XML format, and do web service testing.
Specifically, TestArchitect provides this support with built-in actions that allow you to perform XPath (XML Path Language) queries to search for information in target XML content. An XPath expression uses a path notation for addressing parts of an XML document. For example, the expression
book[@type="Fiction"] refers to the <book> elements whose type attribute is set to
TestArchitect provide the following actions:
- check xml query result: Compare an XPath query result against an expected string and return a Passed or Failed result accordingly.
- get xml query result: Query an XML string by XPath and store the result.
- XML 1.0,
- XML 2.0,
- XPath 1.0,
- and XPath 2.0.
Each of the XML-based built-in actions operates on XML text that is present in an argument. (That is, the actions do not operate directly on XML files.) In most scenarios, the target XML content originates from a file, and hence you will want to load that content into a variable. The most direct means of doing this is to use the built-in action get text file, prior to calling the XML-based action.
For instance: the following test procedure initially loads an XML document’s content using the get text file action. Afterwards, get xml query result is used by passing the variable holding the XML content to the xml argument. In this scenario, get xml query result selects the root element inventory.
file variable get text file D:\bookstore.xml >>bookstore xml xpath variable get xml query result #bookstore /inventory >>allbooks