目录:导读
前言
日常接口测试,需要将接口返回值对应的字段数据保存下来
示例接口:
post请求:
https://dev-xxx-bot.igovee.com/text
{
"text":"I really need some meditative effects."
}
实现方法:
方式一(Jmeter BeanShell采样器提取接口)
接口获取response数据:
{
"cost_time":0.15606689453125,"emotion_class":{
"label":"hope","score":0.2862275540828705},"entity":null,"entity_class":{
"label":"plants","score":0.2635917663574219},"keywords":"fruit"}
jmeter线程组-JSR223 Sampler
代码实例:
//导入json包
import org.json.JSONObject;
import org.json.