在前一篇文章使用jMeter构造大量并发HTTP请求进行微服务性能测试里,我介绍了如何用jMeter构造并发HTTP请求。但是通过文中介绍的方式构造的并发请求,其请求参数都是硬编码的'Wang'.
![700](https://i-blog.csdnimg.cn/blog_migrate/0b2cf783d5420734c8af6b60b744bc5a.webp?x-image-process=image/format,png)
有没有办法让每个并发请求查询的参数都不一样呢?比如让jMeter构造一些从1到100的随机数,作为查询请求的一部分?
JerryTestCustomer_<1~100>
解决方案
创建一个User Parameter:
![700](https://i-blog.csdnimg.cn/blog_migrate/005a389f73392953fe151999f4fd98af.webp?x-image-process=image/format,png)
Parameter的Name为uuid,值为${__Random(1,100)}
这个__Random(1,100)是jMeter提供的随机数发生器。
![700](https://i-blog.csdnimg.cn/blog_migrate/b2345c30bbaf76c242c0be94db68a6ba.webp?x-image-process=image/format,png)
然后在HTTP Request的Parameters标签页里面,使用这个参数即可。
![700](https://i-blog.csdnimg.cn/blog_migrate/7fd70fffe634f618fa2a72bafd0867ec.webp?x-image-process=image/format,png)
测试
随机数生成生效,每个并发请求发出的查询参数现在都不一样了。
![700](https://i-blog.csdnimg.cn/blog_migrate/a6d31674633c8cfee69f6f3f0c69147b.webp?x-image-process=image/format,png)
![700](https://i-blog.csdnimg.cn/blog_migrate/5742bce563ba0bc64a0ebf6ab6b034d9.webp?x-image-process=image/format,png)
![700](https://i-blog.csdnimg.cn/blog_migrate/5984a694495db90afdbc3bbebb60908d.webp?x-image-process=image/format,png)
要获取更多Jerry的原创技术文章,请关注公众号"汪子熙"或者扫描下面二维码:
![321](https://i-blog.csdnimg.cn/blog_migrate/8f78ecbe9f820e292e3b16fcdde8272c.webp?x-image-process=image/format,png)
![531](https://i-blog.csdnimg.cn/blog_migrate/28f78a91dd8ac113576a15d113fccd06.webp?x-image-process=image/format,png)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24475491/viewspace-2153466/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24475491/viewspace-2153466/