下载地址
Apache JMeter - Download Apache JMeter

1. 设置线程组
2. 设置http请求头
3. 设置http请求体
4. 设置结果条目
JSR223 PreProcessor
预处理脚本
import java.util.UUID
def timestamp = System.currentTimeMillis()
vars.put("timestamp", timestamp.toString())
def uuid = UUID.randomUUID().toString()
vars.put("uuid", uuid)
def dirPath = "C:/Users/user/Desktop/archive/Full/train/images"
def indexVar = 'file_index'
def currentIndex = vars.get(indexVar) as Integer ?: 200
def dir = new File(dirPath)
def files = dir.listFiles().findAll { it.isFile() }.sort()
if (currentIndex >= files.size()) {
SampleResult.setStopThread(true)
}
def currentFile = files[currentIndex]
vars.put("currentFilePath", currentFile.absolutePath)
vars.put("name", currentFile.name)
vars.put(indexVar, (currentIndex + 1).toString())
示例

常用函数
${__RandomString(8, abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789)}
${__javaScript( ${__Random(1000, 10000)} / 100 )}
${__Random(100, 1000)}
5万+

被折叠的 条评论
为什么被折叠?



