背景:项目集成测试框架使用unitxml来支持一些测试数据xml全文比较。
难点:待测试的数据是deep nested(深度嵌套)xml文件。
UnitXML(.2) 基本介绍:
https://github.com/xmlunit/xmlunit
https://github.com/xmlunit/user-guide/wiki
InputBuilder: https://github.com/xmlunit/user-guide/wiki/Providing-Input-to-XMLUnit#inputbuilder
DiffBuilder: https://github.com/xmlunit/user-guide/wiki/DiffBuilder
Recursive/Deep Comparison:
https://github.com/lukasz-kusek/xml-comparator
https://assertj.github.io/doc/#assertj-core-recursive-comparison
http://www.itkeyword.com/doc/2366161343653337x511/xmlunit-compare-xml-ignoring-sequence
https://yq.aliyun.com/articles/430271?type=2
RecursiveElementNameAndTextQualifier
is for level 1 only.
multiLevelElementNameandTextQualifier is for deeper level xml comparison.
https://github.com/yashvig24/XMLComparator
github开源项目(实现了deeply nested xml compare功能!!!)
https://github.com/Klinton90/silly_diffhttp://diffdemo.azurewebsites.net/#/collapseDiffOutput
可以看到这里有两个“非常重要”的比较选项:
elements order:支持同名叶子结点的无序比较
INNER elements order:支持同名多层嵌套节点的无序比较