public boolean compareNodes(Node thisResult, Node oldResult){
return thisResult.absoluteMatch(oldResult, false);
}
public void compareTestResults() throws Exception {
XMLPrinter report = new XMLPrinter(compareTestResultsReport());
report.opentag("results");
File outputs = new File(getOutputDirectory());
if(outputs == null || !outputs.isDirectory()){
System.out.println("'"+getOutputDirectory()+"' does not exist or is not a directory");
}
File files[] = outputs.listFiles();
for(File file : files){
if(file.getName().endsWith("_results.xml")){
Node result1=null, result2=null;
try{
result1 = XMLTree.BuildTree(new FileInputStream(file),false,false);
result2 = XMLTree.BuildTree(new FileInputStream(getResultDirectory()+file.getName()),false, false);
if(result1 != null && result2 != null){
if(compareNodes(result1,result2)){
report.printdata("match","file",file.getName(),"");
}else{
report.printdata("resultChanged","file",file.getName(),"");
}
}else{
report.printdata("error","file",file.getName(),"");
}
}catch (Exception e){
report.printdata("unknown","file",file.getName(),"Missing Files to do the compare");
}
}
}
report.closetag();
}