如何处理请求的一部分并在Jmeter的下一个请求中使用它?
我试图记录一个应用程序,登录后我们最初显示100行。当我们滚动超过100行时,延迟加载调用将转到服务器并再获取50条记录。
该呼叫采用JSON格式。对于第一个滚动,它作为请求发送所有100条记录,作为响应,我们得到50条新记录。现在,当我们滚动超过150条记录时,请求将所有150条记录作为请求,并且响应再次返回50条新记录。下一个滚动将发送包含200条记录的累积请求。
现在我正在尝试使用循环控制器来完成循环中的所有滚动。每个延迟加载调用只会提供50条记录,但对于下一次请求迭代,累计记录数将作为请求发送。
我的直觉说为此使用预处理器和后处理器。因为,我是Jmeter的新手,我不确定为此目的使用哪个预处理器,或者是否还有其他替代方法可以解决这个问题。
如果是默认页面响应,fgAhi
并且我需要值A
来传递第一个Json请求。因此,第一个请求类似xAy
,响应为pBq
。现在,对于第二次迭代,我需要请求为xABy
,响应将为pCq
。第三个请求为xABCy
,响应为pDq
,依此类推。
以下是一个例子:
默认页面响应正文:
quiz: [{"question": "Question1","answer": "Answer1"},
{"question": "Question2","answer": "Answer2"},
{"question": "Question3","answer": "Answer3"},
{"question": "Question4","answer": "Answer4"}]
循环控制器: JSON请求体的第一次迭代:
quiz: [{"question": "Question1","answer": "Answer1"},
{"question": "Question2","answer": "Answer2"},
{"question": "Question3","answer": "Answer3"},
{"question": "Question4","answer": "Answer4"},getNextTwoQA]`
第一次迭代响应:
quiz: [{question": "Question5","answer": "Answer5"},
{question": "Question6","answer": "Answer6"}]`
JSON请求体的第二次迭代:
quiz: [[{"question": "Question1","answer": "Answer1"},
{"question": "Question2","answer": "Answer2"},
{"question": "Question3","answer": "Answer3"},
{"question": "Question4","answer": "Answer4"},
{"question": "Question5","answer": "Answer5"},
{"question": "Question6","answer": "Answer6"},getNextTwoQA]
第二次迭代回复:
quiz: [{question": "Question7","answer": "Answer7"},
{question": "Question8","answer": "Answer8"}]
JSON请求体的第3次迭代:
quiz: [{"question": "Question1","answer": "Answer1"},
{"question": "Question2","answer": "Answer2"},
{"question": "Question3","answer": "Answer3"},
{"question": "Question4","answer": "Answer4"},
{"question": "Question5","answer": "Answer5"},
{"question": "Question6","answer": "Answer6"},
{question": "Question7","answer": "Answer7"},
{question": "Question8","answer": "Answer8"},getNextTwoQA]
第3次迭代回复:
quiz: [{question": "Question9","answer": "Answer9"},
{question": "Question10","answer": "Answer10"}]
等等