How To Use
|
The XML data format is widely used within all kinds of applications. XML data may both be used as a format of exchanging data between sw modules at runtime and as a final format to store some complex results. In all these cases it may be of interest to automatically verify the xml contents within unit testing.
To be able to check some xml contents you need a pugi::xml_document or a pugi::xml_node which represents either the root node of your xml document or which corresponds to a subtree of this document. The class TestToolBox::XmlCheck accepts either of these param types (see methods CheckNode, CheckSubNode, Compare) and verifies the belonging xml contents by converting each attribute and node entry to a textual "TestEvent" which can be checked by calling macro TTB_EXP from your test script.
In the simplest case you can request the needed params directly from your test object. For other cases XmlCheck supports you to get easy access to xml contents which are available in string format or within a file:
Read from string
Save to xml file
Read from xml file
When you finally have succeeded in getting a valid pugi::xml_document/xml_node you can check the xml contents: