TestXmlCheckWithBoost
[Test applications]

Win32 console application "TestXmlCheckWithBoost.exe" demonstrates the running of a unit test with Boost.Test lib and performing of XML checks using TestToolBox::XmlCheck. More...

Collaboration diagram for TestXmlCheckWithBoost:

Win32 console application "TestXmlCheckWithBoost.exe" demonstrates the running of a unit test with Boost.Test lib and performing of XML checks using TestToolBox::XmlCheck.


Supported features

Depends on

Typical code snippets

       BOOST_MESSAGE("\nComparing two XML trees");
       BOOST_CHECK(TTB::TheXmlCheck()->Compare(&docA,&docB));
       BOOST_MESSAGE(TTB::TheXmlCheck()->GetCompareResult());
       
       BOOST_MESSAGE("\nComparing two XML subtrees using XPath, ignoring time");
       TTB::TheXmlCheck()->IgnoreAttribute("time");
       BOOST_CHECK(TTB::TheXmlCheck()->Compare(
       TTB::XmlCheck::SubNodeFromXPath(docA.RootElement(), "/MyContainer/Group_B"),
       TTB::XmlCheck::SubNodeFromXPath(docB.RootElement(), "/MyContainer/Group_B")));
       BOOST_MESSAGE(TTB::TheXmlCheck()->GetCompareResult());
       

Project settings

Hints for execution

For better error detection set command line option "--log_level=test_suite"


Log: Detecting some differences when comparing XML trees/subtrees

 Running 3 test cases...
 Entering test suite "Master Test Suite"
 Entering test case "TestCheckNode"

 CheckNode does not produce any output
 see also projects TestXmlCheckBasic,TestXmlCheckWithBoostExtensions
 for more productive examples using EventReceiver concept
 Test case TestCheckNode doesn't include any assertions
 Leaving test case "TestCheckNode"
 Entering test case "TestCompare"

 Comparing two XML trees
 c:/userdata/gerald/sw/c/testtoolbox/test/testxmlcheckwithboost/testxmlcheckwithboost.cpp(193): error in "TestCompare": check TTB::TheXmlCheck()->Compare(&docA,&docB) failed
 Difference detected
 A: time: 09:15:12.234 (line: 3 col: 34, path: //MyContainer/Group_A/Vector)
 B: time: 09:30:12.234 (line: 5 col: 34, path: //MyContainer/Group_A/Vector)

 Comparing two XML trees without differences
 XML-Compare: no differences found

 Comparing two XML trees without differences - now suppressing OK message

 Comparing two XML trees, ignoring time
 c:/userdata/gerald/sw/c/testtoolbox/test/testxmlcheckwithboost/testxmlcheckwithboost.cpp(211): error in "TestCompare": check TTB::TheXmlCheck()->Compare(&docA,&docB) failed
 Difference detected
 A: tolerance: 0.0258 (line: 7 col: 54, path: //MyContainer/Group_A/Vector)
 B: tolerance: 0.8258 (line: 9 col: 54, path: //MyContainer/Group_A/Vector)

 Comparing two XML subtrees using XPath
 c:/userdata/gerald/sw/c/testtoolbox/test/testxmlcheckwithboost/testxmlcheckwithboost.cpp(217): error in "TestCompare": check TTB::TheXmlCheck()->Compare( TTB::XmlCheck::SubNodeFromXPath(docA.RootElement(), "/MyContainer/Group_B"), TTB::XmlCheck::SubNodeFromXPath(docB.RootElement(), "/MyContainer/Group_B")) failed
 Difference detected
 A: 3.132437 (line: 18 col: 8, path: //MyContainer/Group_B/x/3.132437/)
 B: 12.132437 (line: 20 col: 8, path: //MyContainer/Group_B/x/12.132437/)

 For more test cases see also projects TestXmlCheckBasic,TestXmlCheckWithExtensionsForBoost
 Leaving test case "TestCompare"; testing time: 31ms
 Entering test case "Cleanup"
 Test case Cleanup doesn't include any assertions
 Leaving test case "Cleanup"
 Leaving test suite "Master Test Suite"

 3 failures detected in test suite "Master Test Suite"
See also:
TestXmlCheckWithBoost.cpp (file documentation)
Using XmlCheck (usage documentation)
Generated on Fri May 27 22:52:49 2011 for TestToolBox by  doxygen 1.6.3