Hi Bill,
I have registered your request as a suggestion to show all differences in a report. In the meantime, I can suggest that you use the below custom comparison script:
[JScript]
...
var obj = // Obtain the target application object
var storedObj = Objects.StoredObject("MyStoredObj");
Log.Message(CompareObjects(obj, storedObj, ""));
...
function CompareObjects(obj, storedObj, excludedProps)
{
var prop, child, storedChild;
var ret = true;
var errorStr = "";
for(var i = 0; i < storedObj.PropertyCount; i++)
{
prop = storedObj.Properties(i);
if(excludedProps.indexOf(prop.Name) > -1) continue;
if(!IsSupported(obj, prop.Name))
{
ret = false;
errorStr += "Object doesn't support the '" + prop.Name + "' property\r\n";
}
if(!CompareStrings(obj[prop.Name].toString(), prop.Value.toString()))
{
ret = false;
errorStr += "Property value mismatch (" + prop.Name + "):\r\n\tStored value = " + prop.Value.toString() + "\r\n\tActual value = " + obj[prop.Name].toString() + "\r\n";
}
}
for(var i = 0; i < storedObj.ChildCount; i++)
{
storedChild = storedObj.Children(i);
child = obj.FindChild("Name", storedChild.Name);
if(!child) ret = false;
ret = CompareObjects(child, storedChild, excludedProps);
}
if(!ret) Log.Error("Objects are not identical", errorStr);
return ret;
}
function CompareStrings(str, pattern)
{
pattern = StringReplace(pattern, "\\", "\\\\", 1);
pattern = StringReplace(pattern, ".", "\\.", 1);
pattern = StringReplace(pattern, "(", "\\(", 1);
pattern = StringReplace(pattern, ")", "\\)", 1);
pattern = StringReplace(pattern, "[", "\\[", 1);
pattern = StringReplace(pattern, "]", "\\]", 1);
pattern = StringReplace(pattern, "*", ".*", 1);
pattern = StringReplace(pattern, "?", ".?", 1);
var re = new RegExp("^" + pattern + "$");
return re.test(str);
}