- 先确认是http接口还是dubbo接口
- 使用模板更新groovy脚本;将接口在本地调试通
- 通过SVN上传代码到Ngrinder
- 创建用例,确认自己是需要做稳定性测试还是基准测试
- 设置代理数(进程数,线程数)
- 设置需要测试的脚本
- 设置测试时间
- 设置需要监控的机器(一般是接口涉及的服务机器,数据库机器)
- 执行完成后;注意看TPS、响应实际、失败率
- 目前日常使用的基准测试,先压5个线程,然后20个,然后100个。
模板:
import HTTPClient.Cookie
import HTTPClient.HTTPResponse
import HTTPClient.NVPair
import ch.qos.logback.classic.Level
import net.grinder.plugin.http.HTTPPluginControl
import net.grinder.plugin.http.HTTPRequest
import net.grinder.script.GTest
import net.grinder.scriptengine.groovy.junit.GrinderRunner
import net.grinder.scriptengine.groovy.junit.annotation.BeforeProcess
import net.grinder.scriptengine.groovy.junit.annotation.BeforeThread
import org.junit.Assert
import org.junit.Before
import org.junit.Test