TestXmlCheckBasic
[Test applications]

Win32 console application "TestXmlCheckBasic.exe" demonstrates the performing of XML checks using TestToolBox::XmlCheck. Test results are simply written to stdout. More...

Collaboration diagram for TestXmlCheckBasic:

Win32 console application "TestXmlCheckBasic.exe" demonstrates the performing of XML checks using TestToolBox::XmlCheck. Test results are simply written to stdout.


Supported features

Depends on

Project settings


Log: Checking and comparing XMLtrees/subtrees

 ______________________________________________
 Testcases for CheckNode
 ______________________________________________

 Examples how to get an XmlNode from an XML string or an XML file
 
 ..............................................
 CheckNode with several output modes
 and some suppressed attributes and nodes
 ..............................................
 
 
 CheckNode (CTX_TEST_EVENT)
 EVENT: MyContainer
 EVENT:   Group_A
 EVENT:     Vector
 EVENT:       id: 1
 EVENT:       date: 01.07.09
 EVENT:       time: 09:15:12.234
 EVENT:       tolerance: 0.0258
 EVENT:       This is the text of the first vector element
 EVENT:       x
 EVENT:         3.14235
 EVENT:     Vector
 EVENT:       id: 2
 EVENT:       date: 01.07.09
 EVENT:       time: 09:15:12.234
 EVENT:       tolerance: 0.0375451
 EVENT:       This is the text of the second vector element
 EVENT:       x
 EVENT:         3.14235
 EVENT:     Vector
 EVENT:       id: 3
 EVENT:       tolerance: 1.357
 EVENT:       x
 EVENT:         6.28532
 EVENT:   Group_B
 EVENT:     x
 EVENT:       1.23456
 EVENT:     x
 EVENT:       2.3581
 EVENT:     x
 EVENT:       3.132437
 EVENT:     x
 EVENT:       4.987654
 EVENT:     x
 EVENT:       5.29741
 EVENT:   Group_C
 EVENT:     Interior
 EVENT:       Something
 EVENT:         Some text
 EVENT:       date
 EVENT:         28.09.09
 
 CheckNode (CTX_INFO)
 INFO: MyContainer
 INFO:   Group_A
 INFO:     Vector
 INFO:       id: 1
 INFO:       date: 01.07.09
 INFO:       time: 09:15:12.234
 INFO:       tolerance: 0.0258
 INFO:       This is the text of the first vector element
 INFO:       x
 INFO:         3.14235
 INFO:     Vector
 INFO:       id: 2
 INFO:       date: 01.07.09
 INFO:       time: 09:15:12.234
 INFO:       tolerance: 0.0375451
 INFO:       This is the text of the second vector element
 INFO:       x
 INFO:         3.14235
 INFO:     Vector
 INFO:       id: 3
 INFO:       tolerance: 1.357
 INFO:       x
 INFO:         6.28532
 INFO:   Group_B
 INFO:     x
 INFO:       1.23456
 INFO:     x
 INFO:       2.3581
 INFO:     x
 INFO:       3.132437
 INFO:     x
 INFO:       4.987654
 INFO:     x
 INFO:       5.29741
 INFO:   Group_C
 INFO:     Interior
 INFO:       Something
 INFO:         Some text
 INFO:       date
 INFO:         28.09.09
 
 CheckNode (CTX_PROT)
 MyContainer
   Group_A
     Vector
       id: 1
       date: 01.07.09
       time: 09:15:12.234
       tolerance: 0.0258
       This is the text of the first vector element
       x
         3.14235
     Vector
       id: 2
       date: 01.07.09
       time: 09:15:12.234
       tolerance: 0.0375451
       This is the text of the second vector element
       x
         3.14235
     Vector
       id: 3
       tolerance: 1.357
       x
         6.28532
   Group_B
     x
       1.23456
     x
       2.3581
     x
       3.132437
     x
       4.987654
     x
       5.29741
   Group_C
     Interior
       Something
         Some text
       date
         28.09.09
 
 CheckNode (CTX_PROT, detailed mode)
 Document (line: 1, col: 1)
 Element: MyContainer (line: 1, col: 1)
   Element: Group_A (line: 2, col: 5)
     Element: Vector (line: 3, col: 9)
       id: 1, as int: 1, as double: 1 (line: 3, col: 17)
       date: 01.07.09, as int: 1, as double: 1.07 (line: 3, col: 24)
       time: 09:15:12.234, as int: 9, as double: 9 (line: 3, col: 40)
       tolerance: 0.0258, as int: 0, as double: 0.0258 (line: 3, col: 60)
       4 attributes
       Text: This is the text of the first vector element (line: 3, col: 79)
       Element: x (line: 4, col: 13)
         Text: 3.14235 (line: 4, col: 16)
     Element: Vector (line: 6, col: 9)
       id: 2, as int: 2, as double: 2 (line: 6, col: 17)
       date: 01.07.09, as int: 1, as double: 1.07 (line: 6, col: 24)
       time: 09:15:12.234, as int: 9, as double: 9 (line: 6, col: 40)
       tolerance: 0.0375451, as int: 0, as double: 0.0375451 (line: 6, col: 60)
       4 attributes
       Text: This is the text of the second vector element (line: 6, col: 82)
       Element: x (line: 7, col: 13)
         Text: 3.14235 (line: 7, col: 16)
     Element: Vector (line: 9, col: 9)
       id: 3, as int: 3, as double: 3 (line: 9, col: 17)
       tolerance: 1.357, as int: 1, as double: 1.357 (line: 9, col: 24)
       2 attributes
       Element: x (line: 10, col: 13)
         Text: 6.28532 (line: 10, col: 16)
   Element: Group_B (line: 13, col: 5)
     Element: x (line: 14, col: 9)
       Text: 1.23456 (line: 14, col: 12)
     Element: x (line: 15, col: 9)
       Text: 2.3581 (line: 15, col: 12)
     Element: x (line: 16, col: 9)
       Text: 3.132437 (line: 16, col: 12)
     Element: x (line: 17, col: 9)
       Text: 4.987654 (line: 17, col: 12)
     Element: x (line: 18, col: 9)
       Text: 5.29741 (line: 18, col: 12)
   Element: Group_C (line: 20, col: 5)
     Element: Interior (line: 21, col: 9)
       Element: Something (line: 22, col: 13)
         Text: Some text (line: 22, col: 24)
       Element: date (line: 23, col: 13)
         Text: 28.09.09 (line: 23, col: 19)
 
 Ignore attributes 'date' and 'time' and node 'date'
 MyContainer
   Group_A
     Vector
       id: 1
       tolerance: 0.0258
       This is the text of the first vector element
       x
         3.14235
     Vector
       id: 2
       tolerance: 0.0375451
       This is the text of the second vector element
       x
         3.14235
     Vector
       id: 3
       tolerance: 1.357
       x
         6.28532
   Group_B
     x
       1.23456
     x
       2.3581
     x
       3.132437
     x
       4.987654
     x
       5.29741
   Group_C
     Interior
       Something
         Some text
 
 Attribute tolerance is a double with precision 3
 Node x is a double with precision 4
 MyContainer
   Group_A
     Vector
       id: 1
       tolerance: 0.026
       This is the text of the first vector element
       x
         3.1424
     Vector
       id: 2
       tolerance: 0.038
       This is the text of the second vector element
       x
         3.1424
     Vector
       id: 3
       tolerance: 1.357
       x
         6.2853
   Group_B
     x
       1.2346
     x
       2.3581
     x
       3.1324
     x
       4.9877
     x
       5.2974
   Group_C
     Interior
       Something
         Some text
 
 Attribute tolerance is a double with precision 2
 Node x is a double with precision 1
 MyContainer
   Group_A
     Vector
       id: 1
       tolerance: 0.03
       This is the text of the first vector element
       x
         3.1
     Vector
       id: 2
       tolerance: 0.04
       This is the text of the second vector element
       x
         3.1
     Vector
       id: 3
       tolerance: 1.36
       x
         6.3
   Group_B
     x
       1.2
     x
       2.4
     x
       3.1
     x
       5.0
     x
       5.3
   Group_C
     Interior
       Something
         Some text
 
 Ignore node 'Group_A'
 MyContainer
   Group_B
     x
       1.2
     x
       2.4
     x
       3.1
     x
       5.0
     x
       5.3
   Group_C
     Interior
       Something
         Some text
 
 ..............................................
 CheckSubNode with use of XPath expressions
 ..............................................
 
 Reset to defaults
 MyContainer
   Group_A
     Vector
       id: 1
       date: 01.07.09
       time: 09:15:12.234
       tolerance: 0.0258
       This is the text of the first vector element
       x
         3.14235
     Vector
       id: 2
       date: 01.07.09
       time: 09:15:12.234
       tolerance: 0.0375451
       This is the text of the second vector element
       x
         3.14235
     Vector
       id: 3
       tolerance: 1.357
       x
         6.28532
   Group_B
     x
       1.23456
     x
       2.3581
     x
       3.132437
     x
       4.987654
     x
       5.29741
   Group_C
     Interior
       Something
         Some text
       date
         28.09.09
 
 XPath: Check only Group_B
 Group_B
   x
     1.23456
   x
     2.3581
   x
     3.132437
   x
     4.987654
   x
     5.29741
 
 XPath: Check first x element within Group_B
 x
   1.23456
 
 XPath: Check third x element within Group_B
 x
   3.132437
 
 XPath: Check second vector element of Group_A
 Vector
   id: 2
   date: 01.07.09
   time: 09:15:12.234
   tolerance: 0.0375451
   This is the text of the second vector element
   x
     3.14235
 
 XPath: Check last vector element of Group_A
 Vector
   id: 3
   tolerance: 1.357
   x
     6.28532
 
 XPath: Check relative to subtree via SubNodeFromXPath
 Vector
   id: 3
   tolerance: 1.357
   x
     6.28532

 ..............................................
 CheckSubNode with use of multiple XPath expressions
 ..............................................
 
 XPath: Direct acess to second node hierarchy (town within country)
 Town
   name: Munich
   Street
     name: Hauptstrasse
     Contents for Haupstrasse in Munich, Germany
   Street
     name: Bahnhofstrasse
     Contents for Bahnhofstrasse in Munich, Germany
   Street
     name: Leopoldstrasse
     Contents for Leopoldstrasse in Munich, Germany
 
 XPath: Direct acess to third node hierarchy (street within town within country)
 Street
   name: LappersdorferStrasse
   Contents for LappersdorferStrasse in Regensburg, Germany
 
 XPath: Trying to access not existing node
 
 ..............................................
 CheckSubNodeWithMaxChilds limits number of reported direct childs
 ..............................................

 XPath: Limit number of streets to 2
 Town
   name: Munich
   Street
     name: Hauptstrasse
     Contents for Haupstrasse in Munich, Germany
   Street
     name: Bahnhofstrasse
     Contents for Bahnhofstrasse in Munich, Germany
 
XPath: Limit number of streets to 1
 Town
   name: Munich
   Street
     name: Hauptstrasse
     Contents for Haupstrasse in Munich, Germany
 
 ______________________________________________
 Testcases for Compare
 ______________________________________________
 
 Comparing two XML trees
 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)
 
 Ignore attribute 'time'
 Difference detected
 A: tolerance: 0.0375451 (line: 7 col: 54, path: //MyContainer/Group_A/Vector)
 B: tolerance: 0.8258 (line: 9 col: 54, path: //MyContainer/Group_A/Vector)
 
 Ignore node 'Group_A'
 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/)
 
 Ignore node 'Group_B'
 XML-Compare: no differences found
 
 ..............................................
 Using XPath to compare only subtrees
 ..............................................
 
 Comparing with XPath: Comparing full trees
 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)
 
 XPath: Comparing subtree Group_B
 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/)
 
 XPath: Comparing subtree Group_C
 XML-Compare: no differences found
See also:
TestXmlCheckBasic.cpp (file documentation)
Using XmlCheck (usage documentation)
Generated on Fri May 27 22:52:44 2011 for TestToolBox by  doxygen 1.6.3