亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源性能測試工具 > Jmeter
接口性能測試--JMeter
作者:網絡轉載 發布時間:[ 2013/11/6 15:37:25 ] 推薦標簽:

  1.JMeter Java Sampler介紹
  setupTest做些初始化的工作,每個線程只執行一次
  teardownTest做些清理工作,每個線程只執行一次
  runTest具體的測試執行工作,每個并發每次循環都將執行一次
  SampleResult記錄測試結果,result.sampleStart()一個事務開始,result.sampleEnd()一個事務結束
  main方法用于調試
01  package  com . xxx . yyy . perf;
02
03  import  org.apache.jmeter.config.Argument;
04  import  org.apache.jmeter.config.Arguments;
05  import  org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
06  import  org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
07  import  org.apache.jmeter.samplers.SampleResult;
08  import  org.springframework.context.ApplicationContext;
09  import  org.springframework.context.support.ClassPathXmlApplicationContext;
10
11  import  com.xxx.udb.client.PersonService;
12  import  com.xxx.udb.client.result.PersonResult;
13
14  /**
15  *
16  * @author flynewton
17  */
18  public  class  GetPersonByLongId  extends  AbstractJavaSamplerClient  {
19      private  static  final  ApplicationContext  ctx  =  new ClassPathXmlApplicationContext(
20              "spring-udb.xml");
21      private  static  PersonService  personService  =  null;
22      private  static  final  String  loginId  =  "00000sb";
23      private  static  final  String  siteId  =  "CN";
24
25
26      @Override
27      public  void  setupTest( JavaSamplerContext  context)  {
28          super . setupTest( context);
29          personService  = ( PersonService)  ctx . getBean( "personServiceClient");
30      }
31
32      @Override
33      public  void  teardownTest( JavaSamplerContext  context)  {
34          super . teardownTest( context);
35      }
36
37      public  SampleResult  runTest( JavaSamplerContext  arg0)  {
38          SampleResult  result  =  new  SampleResult();
39          PersonResult  personResult  =  null;
40
41          result . setSampleLabel( "result");
42
43          try  {
44              result . sampleStart();
45              personResult  =  personService . getPersonByLongId( siteId ,  loginId);
46              result . sampleEnd();
47          }  catch ( Throwable  t)  {
48              this . getLogger (). error( "Exception:"  +  t);
49              return  null;
50          }
51
52          if ( personResult  !=  null  &&  personResult . getCode()  ==  0)  {
53              result . setSamplerData( personResult . toString());
54              result . setSuccessful( true);
55          }  else  {
56              result . setSuccessful( false);
57          }
58
59          return  result;
60      }
61
62      static  void  printResult( SampleResult  res)  {
63          System . out . println( "test is success:"  +  res . isSuccessful()  +  " used:"
64                  + ( res . getEndTime()  -  res . getStartTime())  +  "ms "  +  " result:"
65                  +  res . getSampleLabel()  +  ":"  +  res . getSamplerData());
66      }
67
68      public  static  void  main( String []  args)  {
69          GetPersonByLongId  service  =  new  GetPersonByLongId();
70          JavaSamplerContext  context  =  new  JavaSamplerContext( null);
71          service . setupTest( context);
72          SampleResult  res1  =  service . runTest( context);
73          printResult( res1);
74          service . teardownTest( context);
75          System . exit( 0);
76      }
77
78  }

上一頁123下一頁
軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 理论片亚洲| 免费xxxxx在线观看网站 | 欧美特黄视频在线观看 | 欧美一级视频高清片 | 清清草视频在线观看 | 97在线视频99播放 | 亚洲无线视频 | 日韩视频在线观看视频 | 国产在线一区在线视频 | 欧美在线黄| 不卡视频国产 | 亚洲国产精品成人综合久久久 | 欧美国产日本精品一区二区三区 | 久久国产精品佐山爱 | 男女下面一进一出的视频免费 | 日本漫画工囗全彩内番怀孕 | 啪啪日韩| 黄色网毛片 | 亚洲另类欧美日韩 | 韩国伦理剧在线看 | 天天摸天天爽天天碰天天弄 | 伊人网综合在线观看 | 成 人 黄 色视频免费播放 | 一级黄色免费看 | 全黄a一级毛片 | 国产成人毛片精品不卡在线 | 狠狠色丁香婷婷综合小时婷婷 | 视频成人永久免费视频 | 日韩中文字幕在线播放 | 午夜院线| 无限看免费视频大全在线播放 | 香蕉污视频在线观看 | 久久手机免费视频 | 日韩一级黄色影片 | 日韩国产精品欧美一区二区 | 日本色片网站 | 人人骚| 一级做α爱过程免费视频 | 羞羞影院在线观看 | 国产高清在线视频一区二区三区 | 天啪天干在线视频 |