【发布时间】:2019-08-23 08:27:28
【问题描述】:
我需要比较 beanshell 采样器中的 json 响应并打印条件是否通过。有人可以帮忙吗,我们如何比较它? 我已经有一个 json 格式的响应,一个我会在测试执行时得到另一个,我需要比较这两个单词。
I tried using if/else but then its not working properly.
JSONObject JsonResponseinput = new JSONObject();
JsonResponseinput.toString();
print(JsonResponseinput + " = PASS");
f.close();
String s=JsonResponseinput.toString();
if (s == JsonResponse)
{
f = new FileOutputStream("output/path/API_OUTPUT.csv", true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(s + " = PASS");
f.close();
}
Else
{
print(JsonResponseinput + " = FAIL")
}
【问题讨论】:
-
JsonResponse是什么?