Sample SilkPerformer Script 2002 Segue Corporation


Sample SilkPerformer Script 2002 Segue Corporation

In Chapter 7, we included subsets of a Pet Store test script as examples. In this section, we include the complete SilkPerformer script for this example. [6] Warning: We do not recommend Pet Store as a performance benchmark application for running under load conditions. We provide these scripts merely as examples for building your own test scripts, but we do not recommend that you use them for actual performance testing.

[6] Equally profuse thanks to Stephan Asboeck for his work on this sample script.

Sign-in , Browse, and Purchase Script

 benchmark SilkPerformerRecorder use "WebAPI.bdh" dcluser  user    VUser  transactions    TInit : begin;    TMain : 1; var  sUsername, sPassword, sCardNumber, sExpirationMonth, sExpirationYear, sTelephone: string; dclrand  sCreditCardType  : RndInd("Visa" = 0.3; "Mastercard" = 0.3;  "AmericanExpress" = 0.4);  sThreeDigits     : RndStr("0123456789", 3..3);  sFourDigits      : RndStr("0123456789", 4..4);  sGivenName       : RndFile("Efname.rnd", 64);    // random first name  sFamilyName      : RndFile("Elname.rnd", 64);    // random last name  sAddress1        : RndFile("Address.rnd", 64);   // random address  sCity            : RndFile("City.rnd", 64);      // random city  sStateOrProvince : RndInd("California" = 0.3; "New York" = 0.3; "Texas" = 0.4);  sPostalCode      : RndStr("0123456789", 5..5);   // random postal code dcltrans transaction TInit  begin    WebSetBrowser(WEB_BROWSER_MSIE5);    WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);    WebSetDocumentCache(true, WEB_CACHE_CHECK_SESSION);    sUsername := "user" + string(GetUserId());    sPassword := "pass" + string(GetUserId());    sCardNumber := sFourDigits + " " + sFourDigits + " " + sFourDigits +  " " + sFourDigits;    sExpirationMonth := string(RndUniN(1 .. 12));    if StrLen(sExpirationMonth) < 2 then sExpirationMonth := "0" +  sExpirationMonth end;    sExpirationYear := "200" + string(RndUniN(2..9));    sTelephone := sThreeDigits + "-" + sThreeDigits + "-" + sFourDigits;   // random phone number  end TInit; transaction TMain  var    nLinks: number;  begin    WebPageUrl("http://ruthless/estore", "Java(TM) Pet Store Demo");    WebPageAddurl(/books/1/396/1/html/2/images/helpHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-inHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-out.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-outHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/searchHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/my_account.gif);    WebPageAddurl(/books/1/396/1/html/2/images/my_accountHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/cartHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fish.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fishHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/dogs.gif);    WebPageAddurl(/books/1/396/1/html/2/images/dogsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/reptiles.gif);    WebPageAddurl(/books/1/396/1/html/2/images/reptilesHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/cats.gif);    WebPageAddurl(/books/1/396/1/html/2/images/catsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/birds.gif);    WebPageAddurl(/books/1/396/1/html/2/images/birdsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/logo-topbar.gif);    WebPageAddurl(/books/1/396/1/html/2/images/splash.gif);    /* Redirecting http://ruthless/estore/populate?command       =checkTables&redirect=/control/language%253Flanguage%253DEnglish ->       http://ruthless/estore/control/language?language=English */    ThinkTime(2.1);    WebPageLink("Enter the store", "Welcome to Java Pet Store Demo");     // Link 4    ThinkTime(5.1);    WebPageLink("sign-in", "Sign In"); // Link 3     ThinkTime(8.2);    /*Form 2 */    WebPageSubmit("button_submit", ESTORE_CONTROL_VERIFYSIGNIN001, "Welcome");    WebPageAddurl(/books/1/396/1/html/2/images/banner_birds.gif);    ThinkTime(3.0);    WebPageLink(NULL, "Welcome to Java Pet Store Demo (#1)"); // Link 1    /* Randomly select a "category" */    WebPageLink(NULL, "Product Category", RndUniN(6 ..10));     nLinks := 0;    while WebPageQueryLink("product?product_id=", nLinks + 1) > 0 do nLinks := nLinks + 1 end;    /* Randomly select a "product" */    WebPageLink(NULL, "Product Category (#1)", 10 + RndUniN(1 .. nLinks));     nLinks := 0;    while WebPageQueryLink("productdetails?item_id=", nLinks + 1) > 0 do "nLinks := nLinks + 1 end;    /* Randomly select an "item" */    WebPageLink(NULL, "Product Information", 10 + RndUniN(1 .. nLinks));     ThinkTime(2.9);    WebPageLink("Add Item to Your Shopping Cart", "Cart"); // Link 11     ThinkTime(6.0);    WebPageSubmit("cart-update", ESTORE_CONTROL_CART002, "Cart (#1)");      // Form 2     WebPageLink("Proceed To Checkout", "Check Out"); // Link 15     WebPageLink("Continue", "Enter Your Information"); // Link 12     ThinkTime(3.7);    WebPageSubmit("button_cont", ESTORE_CONTROL_VALIDATEBILLINGIN003, "Confirm Shipping Data"); // Form 2     WebPageLink("Continue", "Order Shipped"); // Link 11     ThinkTime(7.0);    WebPageLink("sign-out", "Sign Off"); // Link 3  end TMain; dclform  ESTORE_CONTROL_VERIFYSIGNIN001:    "target_screen"           := "" <USE_HTML_VAL> , // hidden, unchanged //value: "null"    "j_username"              := sUsername,    "j_password"              := sPassword,    "submit.x"                := "28", // added    "submit.y"                := "9"; // added  ESTORE_CONTROL_CART002:    "action"                  := "" <USE_HTML_VAL> , // hidden, unchanged //value: "updateCart"    "itemQuantity_EST-1"      := "2", // changed    "update.x"                := "25", // added    "update.y"                := "4"; // added  ESTORE_CONTROL_VALIDATEBILLINGIN003:    "credit_card_type"        := sCreditCardType,    "credit_card_number"      := sCardNumber,    "expiration_month"        := sExpirationMonth,    "expiration_year"         := sExpirationYear,    "given_name"              := sGivenName,    "family_name"             := sFamilyName,    "address_1"               := sAddress1,    "address_2"               := "",    "city"                    := sCity,    "state_or_province"       := sStateOrProvince,    "postal_code"             := sPostalCode,    "country"                 := "USA", // changed    "telephone_number"        := sTelephone,    "ship_to_billing_address" := "on", // changed    "x"                       := "74", // added    "y"                       := "8"; // added 

Search Script

 benchmark SilkPerformerRecorder use "WebAPI.bdh" dcluser  user    VUser  transactions    TInit           : begin;    TMain           : 1; dclrand  sSearchExpressions: RndFile("SearchExpressions.txt", 64); dcltrans  transaction TInit  begin    WebSetBrowser(WEB_BROWSER_MSIE5);    WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);    WebSetDocumentCache(true, WEB_CACHE_CHECK_SESSION);  end TInit;    transaction TMain  var    nLinks: number;  begin    WebPageUrl("http://ruthless/estore", "Java(TM) Pet Store Demo");    WebPageAddurl(/books/1/396/1/html/2/images/helpHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-inHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-out.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-outHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/searchHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/my_account.gif);    WebPageAddurl(/books/1/396/1/html/2/images/my_accountHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/cartHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fish.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fishHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/dogs.gif);    WebPageAddurl(/books/1/396/1/html/2/images/dogsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/reptiles.gif);    WebPageAddurl(/books/1/396/1/html/2/images/reptilesHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/cats.gif);    WebPageAddurl(/books/1/396/1/html/2/images/catsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/birds.gif);    WebPageAddurl(/books/1/396/1/html/2/images/birdsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/logo-topbar.gif);    WebPageAddurl(/books/1/396/1/html/2/images/splash.gif);    /* Redirecting http://ruthless/estore/populate?command=checkTa-       bles&redirect=/control/language%253Flanguage%253DEnglish ->       http://ruthless/estore/control/language?language=English */    ThinkTime(2.5);    WebPageLink("Enter the store", "Welcome to Java Pet Store Demo");     // Link 4    WebPageAddurl(/books/1/396/1/html/2/images/fish1.jpg);    WebPageAddurl(/books/1/396/1/html/2/images/cat1.gif);    WebPageAddurl(/books/1/396/1/html/2/images/bird4.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fish4.gif);    ThinkTime(8.6);    WebPageSubmit("search", ESTORE_CONTROL_SEARCH001, "Search"); // Form 1    ThinkTime(2.8);    nLinks := 0;    while WebPageQueryLink("product?product_id=", nLinks + 1) > 0 do nLinks := nLinks + 1 end;    if nLinks > 0 then      WebPageLink(NULL, "Product Category", 9 + RndUniN(1 .. nLinks));    end;  end TMain; dclform  ESTORE_CONTROL_SEARCH001:    "search_text"             := sSearchExpressions,    "search.x"                := "20",    "search.y"                := "11"; 

New Account Script

 benchmark SilkPerformerRecorder use "WebAPI.bdh" dcluser  user    VUser  transactions    TInit           : begin;    TMain           : 1; var  sUsername, sPassword, sEMail, sTelephone: string; dclrand  sGivenName       : RndFile("Efname.rnd", 64);    // random first name  sFamilyName      : RndFile("Elname.rnd", 64);    // random last name  sAddress1        : RndFile("Address.rnd", 64);   // random address  sCity            : RndFile("City.rnd", 64);      // random city  sStateOrProvince : RndInd("California" = 0.3; "New York" = 0.3; "Texas" = 0.4);  sPostalCode      : RndStr("0123456789", 5..5);   // random postal code  sThreeDigits     : RndStr("0123456789", 3..3);  sFourDigits      : RndStr("0123456789", 4..4);  sLanguage        : RndInd("English" = 0.5; "Japanese" = 0.5);  sCategory        : RndInd("Birds" = 0.2; "Cats" = 0.2; "Dogs" = 0.2; "Fish" = 0.2; "Reptiles" = 0.2); dcltrans  transaction TInit  begin    WebSetBrowser(WEB_BROWSER_MSIE5);    WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);    WebSetDocumentCache(true, WEB_CACHE_CHECK_SESSION);    sUsername  := "user" + string(GetUserId());   // sequential user name    sPassword  := "pass" + string(GetUserId());   // sequential password    /* Sequential e-mail address */    sEMail     := "user" + string(GetUserId()) + "@company.com";    /* Random phone number */    sTelephone := sThreeDigits + "-" + sThreeDigits + "-" + sFourDigits;  end TInit;  transaction TMain  begin    WebPageUrl("http://ruthless/estore", "Java(TM) Pet Store Demo");    WebPageAddurl(/books/1/396/1/html/2/images/helpHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-inHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-out.gif);    WebPageAddurl(/books/1/396/1/html/2/images/sign-outHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/searchHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/my_account.gif);    WebPageAddurl(/books/1/396/1/html/2/images/my_accountHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/cartHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fish.gif);    WebPageAddurl(/books/1/396/1/html/2/images/fishHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/dogs.gif);    WebPageAddurl(/books/1/396/1/html/2/images/dogsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/reptiles.gif);    WebPageAddurl(/books/1/396/1/html/2/images/reptilesHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/cats.gif);    WebPageAddurl(/books/1/396/1/html/2/images/catsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/birds.gif);    WebPageAddurl(/books/1/396/1/html/2/images/birdsHL.gif);    WebPageAddurl(/books/1/396/1/html/2/images/logo-topbar.gif);    WebPageAddurl(/books/1/396/1/html/2/images/splash.gif);    /* Redirecting http://ruthless/estore/populate?command=checkTa-       bles&redirect=/control/language%253Flanguage%253DEnglish ->       http://ruthless/estore/control/language?language=English */    ThinkTime(2.3);    WebPageLink("Enter the store", "Welcome to Java Pet Store Demo");    // Link 4    ThinkTime(10.1);    WebPageLink("sign-in", "Sign In"); // Link 3    WebPageLink("New User", "Create New Account"); // Link 10    ThinkTime(46.8);    WebPageSubmit("button_submit", ESTORE_CONTROL_VALIDATENEWACCOUN001, "Account Created"); // Form 2    ThinkTime(6.7);    WebPageLink("sign-out", "Sign Off"); // Link 3  end TMain; dclform  ESTORE_CONTROL_VALIDATENEWACCOUN001:    "action"                  := "" <USE_HTML_VAL> , // hidden, unchanged    //value: "createAccount"    "user_name"               := sUsername,    "password"                := sPassword,    "user_email"              := sEMail,    "given_name"              := sGivenName,    "family_name"             := sFamilyName,    "address_1"               := sAddress1,    "address_2"               := "",    "city"                    := sCity,    "state_or_province"       := sStateOrProvince,    "postal_code"             := sPostalCode,    "country"                 := "USA",    "telephone_number"        := sTelephone,    "language"                := sLanguage,    "favorite_category"       := sCategory,    "myList_on"               := "on",    "banners_on"              := "on",    "Submit.x"                := "30",    "Submit.y"                := "5"; 


Performance Analysis for Java Web Sites
Performance Analysis for Javaв„ў Websites
ISBN: 0201844540
EAN: 2147483647
Year: 2001
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net