51Testing软件测试论坛

标题: 如何理解以下VU代码?Help [打印本页]

作者: nekkst    时间: 2006-4-29 08:35
标题: 如何理解以下VU代码?Help
/*
      ->-> Session File Information <-<-
       Created: Fri Apr 28 16:59:35 2006
          Name: D:\Program Files\Rational\Rational Test\0428\TestDatastore\DefaultTestScriptDatastore\TMS_Sessions\Test.wch
          Type: CS-Network
*/以上为录制的VU脚本的时间,存储目录,VU类型为网络测试类型

#include <VU.h>//包含需要的头文件
{
push Http_control = HTTP_PARTIAL_OK | HTTP_CACHE_OK | HTTP_REDIRECT_OK;
push Timeout_scale = 200; /* Set timeouts to 200% of maximum response time */
push Think_def = "LR";
Min_tmout = 120000;       /* Set minimum Timeout_val to 2 minutes          */
push Timeout_val = Min_tmout;
push Think_cpu_threshold = 0;

DP1 = datapool_open("Test");
datapool_fetch(DP1);
              
push Think_avg = 0;             /* 0 >= 0 (user think time delay) */

D10_1_254_149 = http_request ["Test001"] "10.1.254.149:80",//需要响应的对象Test001,为什么是Test001,是不是有什么命名规则
     HTTP_CONN_DIRECT,
     "GET / HTTP/1.1\r\n"
     "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
     "ion/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-pow"
     "erpoint, application/msword, */*\r\n"            //以上3行为录制脚本是捕获的所存当前窗口的应用程序,还是其他什么意思不清楚。希望有人能帮我释怀释怀!
     "Accept-Language: zh-cn\r\n"                      //使用语言为中文
     "Accept-Encoding: gzip, deflate\r\n"              //不通
     "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r"   //不通,我使用的都是WINDOWS操作系统,应该都是MSIE,竟然告诉我Mozilla
     "\n"                                              //不知道这个\n是不是回车的意思,是,又为什么?难道单单是为了代码阅读方便?
     "Host: 10.1.254.149\r\n"                          //这个是我输入的地址
     "Connection: Keep-Alive\r\n"                      //正在连接
     "\r\n";


   { string SgenURI_001; }                             //使用了一个SgenURI_001存储相关的URI
     SgenURI_001 = _reference_URI; /* Save "Referer:" string */


set Server_connection = D10_1_254_149;                 //连接服务

http_header_recv ["Test002"]  200;      /* OK */       //接受数据包头

http_nrecv ["Test003"]  100 %% ;        /* 5543 bytes */  //接受数据包体

D10_1_254_149_1 = http_request ["Test004"] "10.1.254.149:80",
     HTTP_CONN_DIRECT,
     "GET /image/style.css HTTP/1.1\r\n"
     "Accept: */*\r\n"
     "Referer: " + SgenURI_001 + "\r\n"
     /* "Referer: http://10.1.254.149/" */
     "Accept-Language: zh-cn\r\n"
     "Accept-Encoding: gzip, deflate\r\n"
     "If-Modified-Since: Tue, 04 Apr 2000 03:59:52 GMT\r\n"
     "If-None-Match: W/\"941-954820792000\"\r\n"
     "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r"
     "\n"
     "Host: 10.1.254.149\r\n"
     "Connection: Keep-Alive\r\n"
     "Cookie: JSESSIONID=72A3ECF5B03364D9E8DB686F8AE490A2\r\n"  //Cookie内容
     "\r\n";


set Server_connection = D10_1_254_149_1;    //这里的IP地址后WHY添加一个序号1

http_header_recv ["Test005"]  304;      /* Not Modified */

http_nrecv ["Test006"]  100 %% ;        /* From Cache */             //从缓存接受数据,但是不明白它在什么时候它分配缓存,以及缓存的大小从上面的代码中没有看到有相关的代码,不知道VU.h里面是不是有相关的内容
set Think_avg = 32;             /* 32 >= 0 (user think time delay) */

/* Keep-Alive request over connection D10_1_254_149_1 */
http_request ["Test007"]
     "GET /image/border.jpg HTTP/1.1\r\n"
     "Accept: */*\r\n"
     "Referer: " + SgenURI_001 + "\r\n"
     /* "Referer: http://10.1.254.149/" */
     "Accept-Language: zh-cn\r\n"
     "Accept-Encoding: gzip, deflate\r\n"
     "If-Modified-Since: Tue, 04 Apr 2006 01:14:38 GMT\r\n"
     "If-None-Match: W/\"16913-1144113278000\"\r\n"                  //这段代码不明白
     "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r"
     "\n"
     "Host: 10.1.254.149\r\n"
     "Connection: Keep-Alive\r\n"
     "Cookie: JSESSIONID=72A3ECF5B03364D9E8DB686F8AE490A2\r\n"
     "\r\n";




/* Keep-Alive request over connection D10_1_254_149_3 */
http_request ["Test106"]
     "GET /public/orgmng/addorg_res.jsp?JGMC="
     + http_url_encode(datapool_value(DP1, "JGMC"))+
     "&JGJB="
     + SgenRes_001[0] +
     "&SJBM="
     + SgenRes_002[0] +
     "&JGTP="
     + SgenRes_003[0] +
     "&BJBM="
     + http_url_encode(datapool_value(DP1, "BJBM"))+
     "&XZQH="
     + http_url_encode(datapool_value(DP1, "XZQH"))+
     "&JGDM="
     + http_url_encode(datapool_value(DP1, "JGDM"))+
     "&WGBM="
     + http_url_encode(datapool_value(DP1, "WGBM"))+
     "&FZR="
     + http_url_encode(datapool_value(DP1, "FZR"))+
     "&LXDH="
     + http_url_encode(datapool_value(DP1, "LXDH"))+
     " HTTP/1.1\r\n"
     "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
     "ion/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-pow"
     "erpoint, application/msword, */*\r\n"
     "Referer: " + SgenURI_012 + "\r\n"
     /* "Referer: http://10.1.254.149/public/orgmng/addorg.jsp" */
     "Accept-Language: zh-cn\r\n"
     "Accept-Encoding: gzip, deflate\r\n"
     "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r"
     "\n"
     "Host: 10.1.254.149\r\n"
     "Connection: Keep-Alive\r\n"
     "Cookie: JSESSIONID=72A3ECF5B03364D9E8DB686F8AE490A2\r\n"
     "\r\n";


http_disconnect(D10_1_254_149_6);

http_disconnect(D10_1_254_149_2);
http_header_recv ["Test107"]  200;      /* OK */

http_nrecv ["Test108"]  100 %% ;        /* 810 bytes */

http_disconnect(D10_1_254_149_4);

http_disconnect(D10_1_254_149_7);

http_disconnect(D10_1_254_149_3);

pop Think_cpu_threshold;
pop [Think_def, Think_avg, Timeout_val, Timeout_scale];

pop Http_control;

}

DATAPOOL_CONFIG "Test"  OVERRIDE DP_NOWRAP DP_SEQUENTIAL DP_SHARED
{
        EXCLUDE, "BJBM", "string", "11111111111111";
        EXCLUDE, "FZR", "string", "11111111111";
        EXCLUDE, "JGDM", "string", "11111";
        EXCLUDE, "JGMC", "string", "总行";
        EXCLUDE, "LXDH", "string", "1111111";
        EXCLUDE, "WGBM", "string", "1111111111111";
        EXCLUDE, "XZQH", "string", "120000";
        EXCLUDE, "opeCode", "string", "000000";
        EXCLUDE, "opePwd", "string", "111111";
}    //这是我登陆输入的参数
作者: nekkst    时间: 2006-4-30 10:20
2天了.没人理?




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2