简体   繁体   English

在 Jmeter http 请求中循环一个 static 值

[英]Loop a static value in Jmeter http request

I have enums called MALE , FEMALE , OTHERS which needs to be send to my http request by looping it.我有名为MALEFEMALEOTHERS枚举,需要通过循环发送到我的 http 请求。

Scenario is when jmeter script runs, a http request will take the value MALE another thread can take the value as FEMALE and continues.场景是当 jmeter 脚本运行时,http 请求将取值 MALE 另一个线程可以取值作为 FEMALE 并继续。 This is important because every ENUM value reaches to different section of the backend system.这很重要,因为每个 ENUM 值都会到达后端系统的不同部分。

I would love hear a help.我很想听到帮助。

在此处输入图像描述

you can see in the above body entity type needs to be changed to all the enums types.您可以在上面的 body 中看到需要将实体类型更改为所有枚举类型。

Normally people go for CSV Data Set Config for this, however if for some reason you cannot or don't want to have external data files you can:通常人们 go 用于CSV 数据集配置为此,但是如果由于某种原因您不能或不想拥有外部数据文件,您可以:

  1. Declare your ENUM values under ie User Defined Variables configuration element:在即用户定义的变量配置元素下声明您的 ENUM 值:

    在此处输入图像描述

  2. Use __RandomFromMultipleVars() function to select a random value from them:使用__RandomFromMultipleVars() function到 select 从中获取随机值:

     ${__RandomFromMultipleVars(MALE|FEMALE|OTHERS,)}

    在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM