https://bz.apache.org/bugzilla/show_bug.cgi?id=65299
Bug ID: 65299
Summary: JSONPathAssertion attributes are out of order
Product: JMeter
Version: 5.4.1
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HTTP
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: JMETER_5.5
I use JSONPathAssertion for Assertion,but the result is failure ,because
attributes are out of order.
Info:
resoponse:
{"a":{"b":{"componentSn":false,"stolen":false,"wepFlag":false,"matchExchangeRule":false,"matchRefurbishRule":false,"needHideActivationDate":false}}}
Asser JSON Path exists:
$.a.b
Expected value:
{"componentSn":false,"stolen":false,"wepFlag":false,"matchExchangeRule":false,"matchRefurbishRule":false,"needHideActivationDate":false}
result:
Assertion failure message:Value expected to match regexp
'{"componentSn":false,"stolen":false,"wepFlag":false,"matchExchangeRule":false,"matchRefurbishRule":false,"needHideActivationDate":false}',
but it did not match:
'{"matchExchangeRule":false,"componentSn":false,"stolen":false,"wepFlag":false,"needHideActivationDate":false,"matchRefurbishRule":false}'
I have try to modify the code like this.., it worked.
class JSONPathAssertion
public static String objectToString(Object subj) {
String str;
if (subj == null) {
str = "null";
} else if (subj instanceof Map) {
// str = (new JSONObject((Map) subj)).toJSONString();
str = new Gson().toJson(subj);
} else if (!(subj instanceof Double) && !(subj instanceof Float)) {
str = subj.toString();
} else {
str = ((DecimalFormat) decimalFormatter.get()).format(subj);
}
return str;
}
--
You are receiving this mail because:
You are the assignee for the bug.