lr中java接口性能测试
1,在lr中创建一个java vuser脚本
在vuser中设置好参数
- import lrapi.lr;
- public class Actions
- {
- //在init方法里面编写一个虚拟用户循环只执行一次的方法,如可以把协商写在里面,就可以达到每个用户协商一次之后,就不再协商的效果
- public int init() throws Throwable {
- return 0;
- }//end of init
- //在aciton方法里面编写需要循环并发的业务方法,如交易的方法,在run_time settings中设置循环的次数。
- public int action() throws Throwable {
- return 0;
- }//end of action
- //在end方法里面编写最后要执行的方法,如释放资源,没有可以不写。
- public int end() throws Throwable {
- return 0;
- }//end of end
- }