• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 數據池(DATAPOOL)專題

    發表于:2011-12-14來源:作者:點擊數: 標簽:javascriptdatapool專題數據
    數據池在 java script:; onClick=javascript:tagshow(event, rational ); target=_self rational 測試中是使用率很高,同時它也充分體現了自動化 測試 的優勢。通過使用數據池,可以通過簡單的腳本完成大量數據的測試,縮短測試時間、提高測試效率和測試 質
    數據池在javascript:;" onClick="javascript:tagshow(event, 'rational');" target="_self">rational測試中是使用率很高,同時它也充分體現了自動化測試的優勢。通過使用數據池,可以通過簡單的腳本完成大量數據的測試,縮短測試時間、提高測試效率和測試質量。下面將介紹數據池的概念、創建以及在GUI、VU腳本中的應用。
        數據池(DATAPOOL)用于存儲測試數據,在腳本中插入數據池命令并增加相關的控制命令后,在腳本回放時就可以自動從數據池中取出數據,完成多組測試數據的測試。
    (一)數據池(DATAPOOL)創建
    1、啟動Rational TestManager;
    2、Tools>Manage>Datapool,點擊New…,輸入數據池名稱點“確定”;
    3、在打開的Data Type Specification中添加字段定義;
    字段定義說明:
    Name:字段名稱
    Type:數據類型
    Sequence:次序,包括Random(隨機)、Sequential(連續)、Unique(唯一)
    Repeat:數據重復次數
    Length:數據長度
    Decimals:小數位數
    Interval:間隔,相鄰兩個數據的間隔數
    Mininum:最小值
    Maxinum:最大值
    Seed:Sequence設為Random時,Seed輸入不同的數據,生成不同的隨機數
    4、在設置好字段后,在No. of records to genarete:中輸入要生成的記錄數,然后點擊Genarete Data 即可生成數據,或者點擊SAVE按鈕,關閉當前窗口,然后點擊manage datapools>edit>edit datapool data,直接手工輸入數據;
    5、這樣就完成了數據池的創建,還可以執行數據池的編輯、改名、刪除、導入、導出等操作;
    6、數據池有數據生成能力,但是不具備數據的計算能力。這種情況下可以利用其他工具(如EXCEL)生成數據,并保存為csv(逗號分割文件)格式,然后在manage datapools中導入;
    (二)、
    1、數據池在GUI腳本中的應用
    這是計算器測試的例子,在GUI中使用數據池需要手工編碼,robot');" target="_self">robot不能自動生成,在手工編碼時可以參考Robot的在線幫助。
    '$Include "sqautil.sbh"

    Sub Main
        Dim Result As Integer
        dim x as integer
        dim num1 as string
        dim num2 as string
        dim sum as string

       
        'Initially Recorded: 2003-7-18  8:51:18
        'Script Name: 計算器-2

        StartApplication "C:\WINNT\system32\calc.exe"
       
        dp=SQADatapoolOpen("jsq"
    '打開數據池,jsp為數據池的名稱,這個數據池是預先按照上述規范做好的

        for x=1 to 5
    Call SQADatapoolFetch(dp)
    '從數據池中讀取記錄
        Call SQADatapoolValue(dp,1,num1)
        Call SQADatapoolValue(dp,2,num2)
    Call SQADatapoolValue(dp,3,sum)
    '將從數據池中讀取的數據賦予相應變量
        Window SetContext, "Caption=計算器", ""
        InputKeys num1 &"{+}"& num2 &"{ENTER}"
       
        Result = LabelVP (CompareNumeric, "Text="& sum &".", "VP=Alphanumeric;Value="& sum &"."
       
        next
       
        Call SQADatapoolClose(dp)
        '關閉數據池
        Window CloseWin, "", ""

    End Sub

    2、數據池在VU腳本中的應用
       VU腳本中的數據池可以通過錄制自動產生,如果不能自動產生可以手工編碼加入。

       以下錄制在Google上搜索的腳本,數據池時錄制時自動產生的:
      #include <VU.h>
    {

    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;

    DP1 = datapool_open("googlw";
    datapool_fetch(DP1);
                
    push Think_avg = 0;

    www_google_com = http_request ["googlw001"] "www.google.com:80",
       HTTP_CONN_DIRECT,
       "GET / HTTP/1.1\r\n"
       "Aclearcase/" target="_blank" >ccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
       "ion/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, ap"
       "plication/x-shockwave-flash, */*\r\n"
       "Accept-Language: zh-cn\r\n"
       "Accept-Encoding: gzip, deflate\r\n"
       "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR"
       " 1.1.4322)\r\n"
       "Host: www.google.com\r\n"
       "Connection: Keep-Alive\r\n"
       "Cookie: PREF=ID=6011af2d9ae9ecc9:TB=2:TM=1079509149:LM=1079509149:S=Bbt"
       "iwXYs9ldWNF0T\r\n"
       "\r\n";
    set Server_connection = www_google_com;

    http_header_recv ["googlw002"]  302;    /* Moved Temporarily */

    http_nrecv ["googlw003"]  100 %% ;      /* Internally Generated */

    {
      string SgenRes_001[];
      SgenRes_001 = http_find_values("RedirectPrefix", HTTP_REDIRECT_PREFIX, 2);
      CHECK_FIND_RESULT(SgenRes_001,"RedirectPrefix","/intl/zh-CN/")
    }

    set Think_avg = 190;

    /* Keep-Alive request over connection www_google_com */
    http_request ["googlw004"]
       "GET " + SgenRes_001[0] + " HTTP/1.1\r\n"
       "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
       "ion/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, ap"
       "plication/x-shockwave-flash, */*\r\n"
       "Accept-Language: zh-cn\r\n"
       "Accept-Encoding: gzip, deflate\r\n"
       "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR"
       " 1.1.4322)\r\n"
       "Host: www.google.com\r\n"
       "Connection: Keep-Alive\r\n"
       "Cookie: PREF=ID=6011af2d9ae9ecc9:TB=2:TM=1079509149:LM=1079509149:S=Bbt"
       "iwXYs9ldWNF0T\r\n"
       "\r\n";

       { string SgenURI_003; }
       SgenURI_003 = _reference_URI; /* Save "Referer:" string */


    http_header_recv ["googlw005"]  200;    /* OK */

    http_nrecv ["googlw006"]  100 %% ;      /* 1407 bytes */

    {
      string SgenRes_002[];
      SgenRes_002 = http_find_values("hl", HTTP_HREF_DATA, 1);
      CHECK_FIND_RESULT(SgenRes_002,"hl","zh-CN")
    }

    {
      string SgenRes_003[];
      SgenRes_003 = http_find_values("ie", HTTP_HREF_DATA, 1);
      CHECK_FIND_RESULT(SgenRes_003,"ie","UTF-8")
    }

    {
      string SgenRes_004[];
      SgenRes_004 = http_find_values("oe", HTTP_HREF_DATA, 1);
      CHECK_FIND_RESULT(SgenRes_004,"oe","UTF-8")
    }

    {
      string SgenRes_005[];
      SgenRes_005 = http_find_values("lr", HTTP_FORM_DATA, 3);
      CHECK_FIND_RESULT(SgenRes_005,"lr","lang_zh-CN")
    }
    set Think_avg = 6228;

    /* Keep-Alive request over connection www_google_com */
    http_request ["googlw007"]
            "GET /search?q="
         + http_url_encode(datapool_value(DP1, "q"))+
         "&ie="
         + SgenRes_003[0] +
         "&oe="
         + SgenRes_004[0] +
         "&hl="
         + SgenRes_002[0] +
         "&btnG="
         + http_url_encode(datapool_value(DP1, "btnG"))+
         "&lr="
         + SgenRes_005[0] +
         " HTTP/1.1\r\n"
       "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, applicat"
       "ion/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, ap"
       "plication/x-shockwave-flash, */*\r\n"
       "Referer: " + SgenURI_003 + "\r\n"
       /* "Referer: http://www.google.com/intl/zh-CN/" */
       "Accept-Language: zh-cn\r\n"
       "Accept-Encoding: gzip, deflate\r\n"
       "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR"
       " 1.1.4322)\r\n"
       "Host: www.google.com\r\n"
       "Connection: Keep-Alive\r\n"
       "Cookie: PREF=ID=6011af2d9ae9ecc9:TB=2:TM=1079509149:LM=1079509149:S=Bbt"
       "iwXYs9ldWNF0T\r\n"
       "\r\n";

       { string SgenURI_004; }
       SgenURI_004 = _reference_URI; /* Save "Referer:" string */


    http_header_recv ["googlw008"]  200;    /* OK */

    http_nrecv ["googlw009"]  3145;         /* 3145/4855 bytes */

    http_nrecv ["googlw010"]  1630;         /* 4775/4855 bytes */

    http_nrecv ["googlw011"]  100 %% ;      /* Last 80 of 4855 bytes */

    http_disconnect(www_google_com);

    pop [Think_def, Think_avg, Timeout_val, Timeout_scale];

    }

    DATAPOOL_CONFIG "googlw"        OVERRIDE DP_NOWRAP DP_SEQUENTIAL DP_SHARED
    {
            EXCLUDE, "btnG", "string", "Google鎼滅儲";
            EXCLUDE, "q", "string", "軟件測試\";
    }

    以下是全部手工編寫的使用數據池的VU腳本:
    #include <VU.h>
    {
    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;
    DP1 = datapool_open("test");   //打開數據池

    ser=sqlconnect("server","sa","8888","192.168.1.12","sqlserver");
    set Server_connection = ser;
    push Think_avg = 0;

    for (i=0; i<10; i++)
    {
       datapool_fetch(DP1); //移動指針到下一記錄
       sqlexec ["sql_1000"] "TestDB..test " +datapool_value(DP1, "q");
    }
    sqldisconnect (ser);
    datapool_close (DP1);   //關閉數據池
    }

    DATAPOOL_CONFIG "test"  DP_SEQUENTIAL DP_SHARED DP_WRAP
    {
            INCLUDE, "q", "string", "8";
    }

        GUI中的數據池只能手工編碼修改,VU中的數據池可以通過edit――datapool infoermation進行配置。此菜單在GUI腳本下為灰色不可操作。

     
     
     

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>