当前位置:网站首页>TESTNG中的并发测试invocationCount, threadPoolSize, timeOut的使用
TESTNG中的并发测试invocationCount, threadPoolSize, timeOut的使用
2022-07-25 18:01:00 【马丁•路德•王】
在testng注解中使用以下注解达到并发测试的目的,例如秒杀等:
invocationCount----表示执行的次数
threadPoolSize-----表示线程池的内线程的个数
timeOut-------超时时间-毫秒
代码:
import org.testng.annotations.Test;
public class mumu {
private static int i = 0;
@Test(threadPoolSize = 1, invocationCount = 10, timeOut = 1000)
public void ThreadTest() {
++i;
System.out.println("the i is -->" + i);
}
}这里设置的是每个线程池中线程是1,但是线程的个数取决于CPU的数量
更改
threadPoolSize =4
结果:
the i is -->3
the i is -->1
the i is -->1
the i is -->2
the i is -->7
the i is -->4
the i is -->5
the i is -->6
the i is -->8
the i is -->9
边栏推荐
- Redis source code and design analysis -- 15. RDB persistence mechanism
- OSPF综合实验
- H5 test point (mind map)
- Auditing related notes
- Cross validation (CV) learning notes
- How many points did NPDP pass? How to pass with high scores?
- Basic knowledge of software testing (mind mapping)
- Memory and packet buffer management of LwIP
- Installation steps and usage of NVM under windows10 system
- PHP解决并发问题的几种实现
猜你喜欢

「数字安全」警惕 NFT的七大骗局

绘制pdf表格 (二) 通过itext实现在pdf中绘制excel表格样式设置中文字体、水印、logo、页眉、页码

Food safety | eight questions and eight answers take you to know crayfish again! This is the right way to eat!

喜讯!瑞云科技被授予“海上扬帆”5G融合应用专委会成员单位

The new version of 3dcat v2.1.3 has been released. You can't miss these three function updates!

排序还需要了解的信息以及链表

为什么数字化未来取决于3D实时渲染

What is the relationship between cloud fluidization and cloud desktop

Idea 必备插件

OSPF综合实验
随机推荐
Landmark buildings around the world
Mock service Moco series (II) - JSON format, file file, header, cookie, solving Chinese garbled code
专访即构科技李凯:音视频的有趣、行业前沿一直吸引着我
UnitTest框架应用
[MySQL]数据库中的索引为什么是用B+树来实现? 哈希表/红黑树/B树是否可行呢?
How to read a Book
Briefly describe synchronized and lock upgrade
WPF implements user avatar selector
大话DevOps监控,团队如何选择监控工具?
Automated test Po design model
STM8S003F3 uart的使用
Why the future of digitalization depends on 3D real-time rendering
SDLC 软件开发生命周期及模型
排序还需要了解的信息以及链表
Joseph Ring problem
Oracle导入出错:IMP-00038: 无法转换为环境字符集句柄
Mock服务moco系列(二)- Json格式、File文件、Header、Cookie、解决中文乱码
Food safety | eight questions and eight answers take you to know crayfish again! This is the right way to eat!
RedisTemplate解决高并发下秒杀系统库存超卖方案 — Redis事务+乐观锁机制
HCIP第一天实验