10.4 Test Assert Methods

     

10.4 Test Assert Methods

The descriptions in the following list are based on the Javadocs for the class XMLTestCase , which contains all of the following test assert methods. The test assert methods use the classes Diff , Validator , NodeTest , and NodeTester from the package org.custommonkey.xmlunit . They also use the interface org.w3c.dom.Document and the class java.io.Reader . The fully qualified package names for these classes are omitted here. Most of the assert methods have variants that perform a given test on either a DOM Document or String representation of XML content.


assertNodeTestPasses(NodeTest test, NodeTester tester, short[] nodeTypes, boolean assertion)

Executes a NodeTest using a NodeTester for the specified node types. Assert passes if NodeTest passes and assertion is TRUE , or if NodeTest fails and assertion is FALSE .


assertNodeTestPasses(String xmlString, NodeTester tester, short nodeType)

Executes a NodeTest using a NodeTester for a single node type and asserts that it passes.


assertXMLEqual(Diff diff, boolean assertion)

assertXMLEqual(String msg, Diff diff, boolean assertion)

Assert that the result of an XML comparison is or is not similar.


assertXMLEqual(Document control, Document test)

assertXMLEqual(String err, Document control, Document test)

assertXMLEqual(Reader control, Reader test)

assertXMLEqual(String err, Reader control, Reader test)

assertXMLEqual(String control, String test)

assertXMLEqual(String err,String control, String test)

Assert that two XML documents are similar.


assertXMLIdentical(Diff diff, boolean assertion)

assertXMLIdentical(String msg, Diff diff, boolean assertion)

Assert that the result of an XML comparison is or is not identical.


assertXMLNotEqual(Document control, Document test)

assertXMLNotEqual(String err, Document control, Document test)

assertXMLNotEqual(Reader control, Reader test)

assertXMLNotEqual(String err, Reader control, Reader test)

assertXMLNotEqual(String control, String test)

assertXMLNotEqual(String err, String control, String test)

Assert that two XML documents are not similar.


assertXMLValid(String xmlString)

Asserts that xmlString contains valid XML. To pass, it must contain a DOCTYPE declaration, a DTD defining an element type, and at least one root element.


assertXMLValid(String xmlString, String systemId)

Asserts that xmlString contains valid XML. To pass, it must contain a DOCTYPE declaration and a root element. The test uses systemId to obtain the DTD.


assertXMLValid(String xmlString, String systemId, String doctype)

Asserts that xmlString contains valid XML. The XML string will be validated with the doctype and systemId specified, regardless of whether it already contains a DOCTYPE declaration.


assertXMLValid(Validator validator)

Asserts that an instance of org.custommonkey.xmlunit . Validator returns isValid( ) == true .


assertXpathEvaluatesTo(String expectedValue, String xpathExpression, Document inDocument)

assertXpathEvaluatesTo(String expectedValue, String xpathExpression, String inXMLString)

Assert the value of an Xpath expression in a DOM Document or XML String.


assertXpathExists(String xPathExpression, Document inDocument)

assertXpathExists(String xPathExpression, String inXMLString)

Assert that a specific XPath exists in a DOM Document or XML String.


assertXpathNotExists(String xPathExpression, Document inDocument)

assertXpathNotExists(String xPathExpression, String inXMLString)

Assert that a specific XPath does not exist in a DOM Document or XML String.


assertXpathsEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument)

assertXpathsEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString)

Assert that the node lists of two XPaths in two DOM Documents or XML strings are equal.


assertXpathsEqual(String controlXpath, String testXpath, Document document)

assertXpathsEqual(String controlXpath, String testXpath, String inXMLString)

Assert that the node lists of two XPaths in the same DOM Document or XML string are equal.


assertXpathsNotEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument)

assertXpathsNotEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString)

Assert that the node lists of two XPaths in two DOM Documents or XML strings are not equal.


assertXpathsNotEqual(String controlXpath, String testXpath, Document document)

assertXpathsNotEqual(String controlXpath, String testXpath, String inXMLString)

Assert that the node lists of two XPaths in the same DOM Document or XML string are not equal.


assertXpathValuesEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument)

assertXpathValuesEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString)

Assert that the evaluation of two XPaths in two DOM Documents or XML strings are equal.


assertXpathValuesEqual(String controlXpath, String testXpath, Document document)

assertXpathValuesEqual(String controlXpath, String testXpath, String inXMLString)

Assert that the evaluation of two XPaths in the same DOM Document or XML string are equal.


assertXpathValuesNotEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument)

assertXpathValuesNotEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString)

Assert that the evaluation of two XPaths in two DOM Documents or XML strings are not equal.


assertXpathValuesNotEqual(String controlXpath, String testXpath, Document document)

assertXpathValuesNotEqual(String controlXpath, String testXpath, String inXMLString)

Assert that the evaluation of two XPaths in the same DOM Document or XML string are not equal.



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net