使用 Jmeter 随机选择产品 [英] Random product selection using Jmeter

查看:41
本文介绍了使用 Jmeter 随机选择产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用 Jmeter 对电子商务 Web 应用程序进行性能测试.
一种流程就像 Search >选择任何产品 >添加到购物车.
在这里,我必须从搜索结果中随机选择任何产品并继续.

I have to performance test an e-commerce web-application using Jmeter.
One flow is like Search > select any product > Add to Cart.
Here I have to select any random product from the search results and proceed.

你能指导我如何选择任何随机产品并继续吗?
我使用的是 Jmeter 2.11.

Can you please guide me on how to select any random product and proceed?
I am using Jmeter 2.11.

推荐答案

您可以按照以下顺序,

(如果你知道有多少产品那么)

(If you know how many products are there then)

1. add random variable with values 1-no. of products. this will generate random values for each user/iteration
2. use values from random variable (var1) in regular expression extractor for random occurance (var1 occurance which is random every time)

(如果你不知道有多少产品存在,如果你的回复包含产品数量)

(If you dont know how many products are present and if your response contains no. of products count then)

1. In first regular expression extract count of products in a variable 
2. add random variable with values 1-value for first regex. this will generate random values for each user/iteration
3. use values from random variable (var1) in regular expression extractor for random occurance

我在我的 assgn 中使用了类似的技术.附上快照以供参考.

I have used similar technique in my assgn. attaching snapshots for reference.

随机选择器

计数的第一个正则表达式

first regex for count

随机变量

随机出现的第二个正则表达式

2nd regex for random oocurance

您可以根据需要修改正则表达式.

you can modify regex as per your requirement.

这篇关于使用 Jmeter 随机选择产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆