使用Jmeter随机选择产品 [英] Random product selection using Jmeter
问题描述
我必须使用Jmeter对电子商务Web应用程序进行性能测试.
一股流就像Search > select any product > Add to Cart
.
在这里,我必须从搜索结果中选择任何随机产品,然后继续.
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.
推荐答案
您可以按照以下顺序进行操作,
You can follow below sequence,
(如果您知道那里有多少种产品)
(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屋!