我只有一个线程组。
登录api(用户A,B,C,D,E,F存储在CSV文件中)
获取航班信息(身体:出发时间,出发机场,目的地) 我的要求:
{
"DepartDate": "2018-08-22",
"DepartAirport": "PuDong",
"Destination": "Beijing"
}
响应格式如下:
{
"DepartTime": "2018-08-22",
"BookableTime": [
{
"DepartTime": "2018-08-22T03:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
},
{
"DepartTime": "2018-08-22T06:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
},
{
"DepartTime": "2018-08-22T07:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
},
{
"DepartTime": "2018-08-22T08:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
},
{
"DepartTime": "2018-08-22T09:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
},
{
"DepartTime": "2018-08-22T011:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
},
{
"DepartTime": "2018-08-22T013:30:00",
"DepartAirport": "PuDong",
"Destination": "Beijing"
}
] }
预订航班API(我希望其他用户预订不同的航班) 我的要求:
{
"DepartAirport": "PuDong",
"Destination": "Beijing",
"ClassType": "Economy",
"DepartTime": "${time}"
}
我希望用户A预订第一趟航班,用户B预订第二趟航班,....如何实现?目前,我必须在CSV文件中输入所有航班,并且我认为这很酷。
答案 0 :(得分:1)
配置如下:
这将导致以下JMeter Variables:
time_1=2018-08-22T03:30:00
time_2=2018-08-22T06:30:00
time_3=2018-08-22T07:30:00
time_4=2018-08-22T08:30:00
time_5=2018-08-22T09:30:00
time_6=2018-08-22T011:30:00
time_7=2018-08-22T013:30:00
现在您需要为用户1使用time_1
,为用户2使用time_2
,依此类推。您可以使用__threadNum()和__V()函数{{ 3}},例如:
${__V(time_${__threadNum})}