小编MKh*_*aja的帖子

SoapUI log.info在比较两个xml文件并记录差异时出于某种原因打开对话框

出于某种原因,执行以下脚本时,不仅会在日志中打印输出,还会在信息弹出对话框中打印输出.有人可以向我解释为什么会发生这种情况以及如何防止它发生?

import groovy.io.FileType;
import org.custommonkey.xmlunit.*;

def file1 = "somepath/file1.xml"
def file2 = "somepath/file2.xml"

def xml1 = new FileReader(file1)
def xml2= new FileReader(file2)
XMLUnit.setIgnoreWhitespace(true)
XMLUnit.setIgnoreComments(true)
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true)
XMLUnit.setNormalizeWhitespace(true)

DetailedDiff myDiff = new DetailedDiff(new Diff(xml1, xml2));
List allDifferences = myDiff.getAllDifferences();

allDifferences.each { difference ->
    log.info (difference)
}
Run Code Online (Sandbox Code Playgroud)

编辑:通过实验,我发现以下行:

List allDifferences = myDiff.getAllDifferences();
Run Code Online (Sandbox Code Playgroud)

是对话弹出的原因.我猜测getAllDifferenes()方法导致弹出对话框.

我仍然想要一些帮助来确定一个可行的替代方案,因为我试图比较两个xml文件并打印文件中的差异.

groovy soapui xmlunit

2
推荐指数
1
解决办法
2566
查看次数

标签 统计

groovy ×1

soapui ×1

xmlunit ×1