Questions tagged [xmlunit]

XMLUnit is an open source project which enables JUnit-style assertions to be made about the content and structure of XML.

XMLUnit extends and to enable unit testing of XML.

It compares a control XML document to a test document or the result of a transformation, validates documents, and compares the results of expressions.

XMLUnit for Java

XMLUnit for Java provides two JUnit extension classes, XMLAssert and XMLTestCase, and a set of supporting classes (e.g. Diff, DetailedDiff,Transform,SimpleXpathEngine,Validator,NodeTest) that allow assertions to be made about:

  • The differences between two pieces of XML
  • The outcome of transforming a piece of XML using XSLT
  • The evaluation of an XPath expression on a piece of XML
  • The validity of a piece of XML
  • Individual nodes in a piece of XML that are exposed by DOM Traversal

XMLUnit for Java can also treat HTML content (even badly-formed HTML) as valid XML to allow these assertions to be made about the content of web pages too.

XMLUnit is available for and .

184 questions
0
votes
2 answers

XML comparision using xmlunit customizing output message

Hi I am trying to compare content of two xml files using xmlunit Here are my input xmls reference.xml abc 9971-5-0210-0 abc
Shabarinath Volam
  • 789
  • 5
  • 19
  • 48
0
votes
0 answers

Groovy script to read multiple xml files one at a time from 2 folders and apply xmlunit comparison methods

I have series of xml files placed in 2 separate folders as below. My objective is to read each file one at a time from both folders and apply xmlunit comaprison methods. Folder1 : actual1.xml actual2.xml actual3.xml Folder2…
yashm7
  • 11
  • 2
0
votes
0 answers

How to read two XML files using XMLUnit

I am new to XML.After a lot of search i found XMLUnit to do that but the problem am getting is : whenever i change the contents of xml file to simple string text and try to execute the code ,it still shows green in junit test which it should not…
Vivek
  • 13
  • 1
  • 6
0
votes
1 answer

XMLUnit's ElementQualifier gets confused when there are multiple Elements with same tag name

I am trying to compare below two XMLs... I am doing a similarity test. XML1 true ooo
NewQueries
  • 4,841
  • 11
  • 33
  • 39
0
votes
1 answer

How to make XMLUnit work in eclipse?

I have the JUnit (junit-4.11.jar) installed in eclipse as you can see in the screenshot below but I have no idea how to make XMLUnit work. Can somone please help? As you can see I've downloaded the .zip (xmlunit-0.4.zip) from XMLUnit website and…
letakeda
  • 155
  • 3
  • 12
0
votes
1 answer

XMLUnit diff with HTML files

I am trying to use XMLUnit's diff with two HTML documents. To do this, I convert them to strings and then construct a diff object from the two strings. However, this throws the following SAXException: [Fatal Error] :1:177: The element type "br" must…
aftrumpet
  • 1,189
  • 2
  • 16
  • 28
0
votes
1 answer

XMLUNIT - Comparing two xmls with differing Nodes

I have 2 XMLs to be compared: File1.xml 1021 First Year John File2.xml
user2967948
  • 529
  • 2
  • 8
  • 23
0
votes
1 answer

XMLUnit RecursiveElementNameAndTextQualifier not working

Hi I'm trying to use XML Units RecursiveElementNameAndTextQualifier , But my below test is failing. When I interchange the value of foo3 and foo2 in below test xml file , the test is passed with true (for diff.similar()) . Not sure what the…
srinannapa
  • 3,085
  • 8
  • 49
  • 66
0
votes
1 answer

Comparing XML with XML unit using RecursiveElementNameAndTextQualifier

I'm trying to compare two xml structure's using XML Unit with RecursiveElementNameAndTextQualifier. My Program and XML's are below. String control = " "+ " "+ " "+ " 1 "+ " "+ …
srinannapa
  • 3,085
  • 8
  • 49
  • 66
0
votes
1 answer

XmlUnit empty Elements

I try to compare two xml with xmlUnit. I have the following problem. When i have two empty elements like the example below xmlUnit identificate the elements as a difference. Can i configure xmlUnit to ignore this? and I am only…
urs
  • 11
  • 3
0
votes
1 answer

xmlunit: strange matching for pom.xml files

I am trying to get the differences of two Maven POM files with the XMLUnit. First of all my code: package com.company.control.cfgmgnt.tools.pommerge.core.internal.xml.comparison; import java.io.File; import java.util.ArrayList; import…
0
votes
1 answer

Call an XMLUnit-test from another class

I'm using XMLUnit to compare two XMLs. This works fine when i perform the test class manual as a jUnit test. But now i want to call the tests i have from another class. I can perform the testMethod, but nothing happens here an example for the class…
HamstersBlue
  • 115
  • 1
  • 1
  • 9
0
votes
1 answer

Groovy and XMLUnit: compare webservice results

Using Groovy and XMLUnit I am trying to write a script to compare the xml output of web services from multiple endpoints. Attempting to get it working from one endpoint then iterate over endpoints to compare output, however, I continue to get the…
0
votes
2 answers

Xml Parsing and Comparison

I have two Xml:- String xmlA="Jai3128March1990"; String xmlB="Jai Singh3128March1990"; Now After parsing and comparing, I want to show the results in…
Vivek Agrawal21
  • 304
  • 5
  • 21
0
votes
1 answer

How to catch AssertPathsEqual and print error to console?

How could I catch this AssertionFailedError and print to the console an message that says: "Expected text value '55555' but was '55556' at /xpathResult[1]/result[2]/field[1]/field[1]/field[6]/text()[1] for [testFileName] and [testName]" I'm not…
djangofan
  • 28,471
  • 61
  • 196
  • 289
1 2 3
12
13