I have 2 thread groups
Thread group1:
csv data set configure
{
loop through the csv file(CSVFile.csv) that contain fileNames of json data to post
eg: CSVFile.csv
file1.json
file2.json
.....so on
}
http request (That posts the data to rest api) (lets call it POST request)
{
extracts data from each json file and put it in http body and post to rest api
eg:
extract data from file1.json and post
}
jsr223 post processor
{
extracting data from above http responce and saving it to a file
}
Thread group2:
csv data configure
{
reads data from csv file
}
http request (Perform GET operation on rest api) (lets call it GET request)
{
eg:
GET ip:port/searchParameter=value
}
现在的问题是,每当线程group1的http请求的迭代完成时,如何触发线程group2,并在不等待线程group2完成的情况下进行迭代2。
eg:
POST request -> file1.json completion should trigger GET request
As the GET request continues to execute
POST request -> file2.json should be excuted concurrently
CAN I DO THIS?
答案 0 :(得分:1)
我建议删除将响应数据保存到文件中并在第二线程组中读取的临时步骤,您可以使用JSON Extractor和JMeter Variables在单个线程组的范围内实现相同的目的-这种方法将更快,因为与磁盘IO操作相比,内存中的操作非常快,而且您不必担心线程组同步。
但是,如果您希望保持现状,则可以考虑使用Inter-Thread Communication插件,该插件可基于简单的synchronisation队列用于FIFO个不同线程组的线程,因此第二个线程当从第一个线程组获得信号时,组将开始。
如果需要,请查看How to Use the Inter-Thread Communication Plugin in JMeter文章以获取更多信息。
安装线程间通信插件。答案 1 :(得分:0)
您可以使用if控制器进行处理。您检查线程1是否成功,将状态是否成功。如果失败,您将失败状态
线程2从线程1检查状态。如果成功,则运行http request