lr中java接口性能测试

1,在lr中创建一个java vuser脚本

lr中java接口性能测试

lr中java接口性能测试


在vuser中设置好参数

lr中java接口性能测试


  1. import lrapi.lr;  
  2. public class Actions  
  3. {  
  4.   
  5. //在init方法里面编写一个虚拟用户循环只执行一次的方法,如可以把协商写在里面,就可以达到每个用户协商一次之后,就不再协商的效果  
  6. public int init() throws Throwable {  
  7. return 0;  
  8. }//end of init  
  9.   
  10. //在aciton方法里面编写需要循环并发的业务方法,如交易的方法,在run_time settings中设置循环的次数。  
  11. public int action() throws Throwable {  
  12. return 0;  
  13. }//end of action  
  14.   
  15. //在end方法里面编写最后要执行的方法,如释放资源,没有可以不写。  
  16. public int end() throws Throwable {  
  17. return 0;  
  18. }//end of end  
  19. }