XPath equals, contains, count, attribute assertions on XML responses. Integration teams covered.
Step phrasings in this group
The book sidebar lists each individual step page under this group.
Given the response content from the file "feed.xml"Load XML response content from a file under tests/assets/.
Given the response content is the following:Set XML response content inline from a Gherkin doc string.
Then the response should be in XML formatAssert the loaded response parses as XML.
Then the response should not be in XML formatAssert the loaded response is NOT XML.
Then the XML element "/root/item" should existAssert at least one XML element matches an XPath.
Then the XML element "/root/missing" should not existAssert NO XML element matches an XPath.
Then the XML element "/root/item" should be equal to "Hello"Assert an XML element's text content equals an expected value (trimmed).
Then the XML element "/root/item" should not be equal to "Bye"Assert an XML element's text content is NOT equal to an expected value.
Then the XML element "/root/item" should contain "Hello"Assert an XML element's text content contains a substring.
Then the XML element "/root/item" should not contain "Error"Assert an XML element's text content does NOT contain a substring.
Then the XML attribute "id" on element "/root/item" should existAssert an XML element has the named attribute.
Then the XML attribute "deprecated" on element "/root/item" should not existAssert an XML element does NOT have the named attribute.
Then the XML attribute "id" on element "/root/item" should be equal to "1"Assert an XML attribute equals an expected value.
Then the XML attribute "id" on element "/root/item" should not be equal to "0"Assert an XML attribute is NOT equal to an expected value.
Then the XML attribute "id" on element "/root/item" should contain "abc"Assert an XML attribute contains a substring.
Then the XML attribute "id" on element "/root/item" should not contain "old"Assert an XML attribute does NOT contain a substring.
Then the XML element "//entry" should have 5 elementsAssert exactly N elements match an XPath.
Then the XML should use the namespace "http://www.w3.org/2005/Atom"Assert the XML root declares an xmlns:* namespace URI.
Then the XML should not use the namespace "http://example.com/legacy"Assert the XML root does NOT declare a namespace URI.
When I print last XML responsePrint the most recently set raw XML response to stdout (debug aid).