Download presentation
Presentation is loading. Please wait.
Published byWilla Gilmore Modified over 6 years ago
1
SCRIPT RECORDING ,SPLITTING AND ADVANCED PARAMETERIZATION
2
GOALS OF TRAINING Script GUI Script Debugging Recording Page Snapshots
Merging And Splitting Of Pages. Transactions Checkpoints With Save Count And simple C Coding. Parameterization Declare Parameters Search Parameters Script Debugging Run with 1 U 1 C, 1 U 10 C in debug mode and check request/response files and page dumps
3
FRAMING STUDIO(www.art.com)
Its is a real world application which is used for selecting different arts and to frame them. In this following is done: Home Page , Go to Category Page, Select category from Left Panel. Ex:- Category: Vintage Art Prints. Product Page ,Select a product from right panel. Select FRAME IT button to get it frame. Select Frame for the print. Select Mat for the print. Select Glass for the print. Select Crop for the print. Select Wall color for the print.
4
Go through the flow manually using IE before starting the script recording.
This will help in understanding the flow which is to be recorded. The flow which is to be recorded is given below.
5
FLOW OF SCRIPT TO RECORD
All Products Click Category From left panel Products Click Product From Right Panel Product
6
Click Frame It Button Framing Page Select A Frame Select Frame Select a Mat Select Mats
7
Select A Glass Select Glass Crop the Image Crop Select Wall Color Wall Color
8
RECORDING
9
Enter the scripts name “ArtFramingStudio”.
Enter the URL . Enter the Project name & Subproject name Either you can choose Project-default, SubProject-default, or Contact the Admin to create your own project or subproject.
10
PAGE 1 OF RECORDING www.art.com
Contains Categories for different arts. Select Category From Left Pane. Ex.: Vintage Art Print
11
PAGE 2 OF RECORDING http://www. art
PAGE 2 OF RECORDING prints.htm?ui=1B5F4DA9682B4DBEAFD15BEFEAFCF72A Select Product from right panel .
12
PAGE 3 OF RECORDING http://www. art
Select FRAME IT button option.
13
PAGE 4 OF RECORDING Select Frame from the bottom panel
Note:-Don’t move pointer to Different frame as it makes an Ajax call every time we move pointer . This can create script more complex. So select frame only once.
14
PAGE 5 OF RECORDING Select Mat from the bottom panel
15
PAGE 6 OF RECORDING Select Glass from the bottom panel
16
PAGE 7 OF RECORDING Select Crop for this crop for the product.
Note:-Cropping is not available for this product
17
PAGE 8 OF RECORDING Select any Wall Color from the bottom panel
18
List of Pages After Recording
19
Here we are not changing the name of the pages because we are not sure of getting the exact flow in the script as we recorded.
20
Analysis Of Script After Recording
Analysis of script is required to check the flow of script recording is done properly. Go through the capture file of script and check all the Url’s whether they are same as recorded. AJAX call can lead to pages into embedded Url’s which are main Url’s.
21
PAGE SNAPSHOTS
22
PAGE 1 OF SNAPSHOT
23
PAGE 3 OF SNAPSHOT
24
PAGE 4 OF SNAPSHOT
25
Page 2 –Index_2 Page5 - Criteo_CreatePopulation and Page 6 - X153424_jpg are not main Url’s so snapshots is not generated for them.
26
MERGING
27
Index_2 is not a main Url ,so required to merge
28
Merging of Index_2 with Index page
29
Merged Page
30
No. of embedded of index increased to 1 as index_2 is merged.
31
Similarly merge the following pages
Criteo_CreatePopulation with keep_calm_and_carry_on_htm X153424_jpg with keep_calm_and_carry_on_htm
32
Script.h AFTER MERGE
33
Changing Page Names
34
PAGE SPLITTING
35
NEED OF SPLITTING While recording some page went to embedded Url which may be main Url. To extract pages from embedded URL to main URL page splitting is done. Splitting is done from script.detail file as it contains all embedded Url’s.
36
THUMB RULES FOR SPLITTING PAGES
If there is any POST method its more likely to split the page. Secondly if there is any AJAX call its more likely to split the page. If we want some data from the url which need to be correlated with the script that must be splitted.
37
FINDING URL’S To get all URL’s from script.detail , Run :
egrep –n “^--PAGE|^GET|^POST” script.detail >script.embed, this will store all Url’s to a file.
38
SPLITTING OF PAGE From beginning we get a POST method at line: 2020,which is not a relevant Url to split.
39
SPLITTING PAGE 1 Next Url is at line no which is the Url for FramingStudio page. Placing the cursor at Line 2051 and right click->Split page.
40
NAMING NEW PAGE Name the Page as FramingStudio
41
PAGE ADDED TO scrip.capture
42
SPLITTING PAGE 2 Next Url is at line no which is the Url for GetFrame page.
43
PAGE ADDED TO scrip.capture
44
SPLITTING PAGE 3 Next Url is at line no which is the Url for GetMats page. URL=GET /frameservice.asmx/GetMats?CustomerZoneID=3&LanguageID=1 HTTP/1.1
45
PAGE ADDED TO scrip.capture
46
SPLITTING PAGE 4 Next Url is at line no which is the Url for GetMoldingGroup page. URL=GET /frameservice.asmx/GetMoldingGroup?customerZoneId=3¤cyId=840&LanguageId=1 HTTP/1.1
47
PAGE ADDED TO scrip.capture
48
SPLITTING PAGE 5 Next Url is at line no which is the Url for GetFramePrice page. URL=GET /frameservice.asmx/GetFramePrice?customerZoneId=3&languageId=1¤cyCode=USD&innerDimensionWidth=24&innerDimensionHeight=32&moldingId= HTTP/1.1
49
PAGE ADDED TO scrip.capture
50
SPLITTING PAGE 6 Next Url is at line no which is the Url for GetMoldings page. URL:-GET /frameservice.asmx/GetMoldings?customerZoneId=3&LanguageId=1 HTTP/1.1
51
PAGE ADDED TO script.capture
52
SPLITTING PAGE 7 Next Url is at line no which is the Url for GetFramePrice_2 page. URL:-GET /frameservice.asmx/GetFramePrice?customerZoneId=3&languageId=1¤cyCode=USD&innerDimensionWidth=24&innerDimensionHeight=32&moldingId= HTTP/1.1
53
PAGE ADDED TO scrip.capture
54
SPLITTING PAGE 8 Next Url is at line no which is the Url for GetFramePrice_2 page.
55
PAGE ADDED TO scrip.capture
56
SPLITTING OTHER PAGES FramingStudio_3(2272)
Similarly, FramingStudio_2(2234) URL=GET/frameservice.asmx/GetSetup?sessionId=840D2761A80B4CE BA461FCF&apnum= &frameId=0&imageId=0&PODConfigID=0&customerZoneId=3&languageId=1¤cyId=840¤cyCode=USD&unitofmeasure=inch HTTP/1.1 FramingStudio_3(2272) URL=GET /frameservice.asmx/GetDefaultComponent?customerZoneID=3&apnum= &PODConfigID=0 HTTP/1.1
57
FramingStudio_4(2280) FramingStudio_5(2412)
URL=GET /frameservice.asmx/GetGlazing?customerZoneId=3&LanguageId=1¤cyCode=USD&innerDimensionWidth=24&innerDimensionHeight=32 HTTP/1.1 FramingStudio_5(2412) URL=GET /frameservice.asmx/GetQuickSaves?sessionId=840D2761A80B4CE BA461FCF&apnum= &PODConfigID=0&imageId=0& Address=&customerZoneId=3&languageId=1 HTTP/1.1
58
FramingStudio_6(2442) URL=GET /frameservice.asmx/UpdateFramedItem?xmlDoc=<FramedItemObject><FramedItemID> </FramedItemID><Summary><SessionStateSummary><FitToFixedFrame>true</FitToFixedFrame><IsTooLargeToShip>0</IsTooLargeToShip><IsMatOversized>false</IsMatOversized></SessionStateSummary><CropSummary><CropId>0</CropId></CropSummary></Summary><Session><SessionID>840D2761A80B4CE BA461FCF</SessionID><CustomerZoneID>3</CustomerZoneID><LanguageID>1</LanguageID><CurrencyID>840</CurrencyID><CurrencyCode>USD</CurrencyCode><UnitOfMeasure>inch</UnitOfMeasure></Session><Item><Identification><Master> </Master></Identification><PrintOnDemand><ConfigIdentifier>0</ConfigIdentifier><ImageID>0</ImageID></PrintOnDemand><Service><Frame><Glass><Identification><Application> </Application></Identification></Glass><Mats><Mat><Identification><Application> </Application></Identification><Position>1</Position><Widths><Dimensions><Top>4.125</Top><Right>4.125</Right><Bottom>4.125</Bottom><Left>4.125</Left></Dimensions></Widths></Mat></Mats><Moldings><Molding><Identification><Application> </Application></Identification></Molding></Moldings></Frame></Service></Item></FramedItemObject> HTTP/1.1
59
GetFramePrice_3(2470) URL=GET /frameservice.asmx/GetFramePrice?customerZoneId=3&languageId=1¤cyCode=USD&innerDimensionWidth=24&innerDimensionHeight=32&moldingId= HTTP/1.1 GetFramePrice_4(2479) URL=GET /frameservice.asmx/GetFramePrice?customerZoneId=3&languageId=1¤cyCode=USD&innerDimensionWidth=24&innerDimensionHeight=32&moldingId= HTTP/1.1
60
FramingStudio_7(2508) URL=GET /frameservice.asmx/UpdateFramedItem?xmlDoc=<FramedItemObject><FramedItemID> </FramedItemID><Summary><SessionStateSummary><FitToFixedFrame>true</FitToFixedFrame><IsTooLargeToShip>0</IsTooLargeToShip><IsMatOversized>false</IsMatOversized></SessionStateSummary><CropSummary><CropId>0</CropId></CropSummary></Summary><Session><SessionID>840D2761A80B4CE BA461FCF</SessionID><CustomerZoneID>3</CustomerZoneID><LanguageID>1</LanguageID><CurrencyID>840</CurrencyID><CurrencyCode>USD</CurrencyCode><UnitOfMeasure>inch</UnitOfMeasure></Session><Item><Identification><Master> </Master></Identification><PrintOnDemand><ConfigIdentifier>0</ConfigIdentifier><ImageID>0</ImageID></PrintOnDemand><Service><Frame><Glass><Identification><Application> </Application></Identification></Glass><Mats><Mat><Identification><Application> </Application></Identification><Position>1</Position><Widths><Dimensions><Top>4.125</Top><Right>4.125</Right><Bottom>4.125</Bottom><Left>4.125</Left></Dimensions></Widths></Mat></Mats><Moldings><Molding><Identification><Application> </Application></Identification></Molding></Moldings></Frame></Service></Item></FramedItemObject> HTTP/1.1
61
GetFrame_3(2522) URL=GET /frameimagehandler/universal/frameimage.jpg?frame=[FAP:0+PRT:[PAP= |PRW=16|PRH=24|PIP=%5c30%5c3001%5cC4BBF00Z.jpg|LFN=ROS\SPQ5453.jpg|LFL=|PWL=299|PHL=450|PWO=1328|PHO=2000]+MLD:[MID= |MIP=|MDW=2|MDH=0.875]+GLS:0+NMM:1+MT1:[MTD= |MTP=|MTC=FFFFFF|MTL=3.75|MTT=3.75|MTR=3.75|MTB=3.75|MDP=0.2|MBV=0.08]+MT2:[MTD=0|MTP=|MTC=|MTL=0|MTT=0|MTR=0|MTB=0|MDP=0.2|MBV=0.08]+MT3:[MTD=0|MTP=|MTC=|MTL=0|MTT=0|MTR=0|MTB=0|MDP=0.2|MBV=0.08]+CRP:[CID=0|CRX=0|CRY=0|CRW=0|CRH=0]+LIN:[LID=0|LFN=|LNW=0|LND=0]+CAN:[CVD=0|CVC=|CVF=|CVS=0]+MLF:[FLD=0|FLW=0|FFP=]+LNF:[FLD=0|FLW=0|FFP=]+TMF:[FLD=0|FLW=0|FFP=]+MMF:[FLD=0|FLW=0|FFP=]+BMF:[FLD=0|FLW=0|FFP=]+FDP:0+MXD:1000+MXW:400+MXH:350+SHI:5+QLT:101+OVH:[TOH=0.125|ROH=0.125|BOH=0.125|LOH=0.125]+CRZ:[CZT=0|CRI=4|LPC=0|TPC=0|WPC=0|HPC=0|CMD=0]] HTTP/1.1
62
FramingStudio_8(2556) URL=GET /frameservice.asmx/UpdateFramedItem?xmlDoc=<FramedItemObject><FramedItemID> </FramedItemID><Summary><SessionStateSummary><FitToFixedFrame>true</FitToFixedFrame><IsTooLargeToShip>0</IsTooLargeToShip><IsMatOversized>false</IsMatOversized></SessionStateSummary><CropSummary><CropId>0</CropId></CropSummary></Summary><Session><SessionID>840D2761A80B4CE BA461FCF</SessionID><CustomerZoneID>3</CustomerZoneID><LanguageID>1</LanguageID><CurrencyID>840</CurrencyID><CurrencyCode>USD</CurrencyCode><UnitOfMeasure>inch</UnitOfMeasure></Session><Item><Identification><Master> </Master></Identification><PrintOnDemand><ConfigIdentifier>0</ConfigIdentifier><ImageID>0</ImageID></PrintOnDemand><Service><Frame><Glass><Identification><Application> </Application></Identification></Glass><Mats><Mat><Identification><Application> </Application></Identification><Position>1</Position><Widths><Dimensions><Top>4.125</Top><Right>4.125</Right><Bottom>4.125</Bottom><Left>4.125</Left></Dimensions></Widths></Mat></Mats><Moldings><Molding><Identification><Application> </Application></Identification></Molding></Moldings></Frame></Service></Item></FramedItemObject> HTTP/1.1
63
TRANSACTIONS
64
ADD THESE TRANSACTION IN THE Script.c
ns_start_transaction("AllProducts"); ns_end_transaction("AllProducts", NS_AUTO_STATUS); ns_start_transaction("Products"); ns_end_transaction("Products", NS_AUTO_STATUS); ns_start_transaction("Product"); ns_end_transaction("Product", NS_AUTO_STATUS);
65
ns_start_transaction("FramingStudio");
ns_end_transaction("FramingStudio", NS_AUTO_STATUS); ns_start_transaction("FramingStudio_2"); ns_end_transaction("FramingStudio_2", NS_AUTO_STATUS); ns_start_transaction("GetFrame"); ns_end_transaction("GetFrame", NS_AUTO_STATUS);
66
ns_start_transaction("GetMats");
ns_end_transaction("GetMats", NS_AUTO_STATUS); ns_start_transaction("FramingStudio_3"); ns_end_transaction("FramingStudio_3", NS_AUTO_STATUS); ns_start_transaction("FramingStudio_4"); ns_end_transaction("FramingStudio_4", NS_AUTO_STATUS);
67
ns_start_transaction("GetMoldingGroup");
ns_end_transaction("GetMoldingGroup", NS_AUTO_STATUS); ns_start_transaction("GetMoldings"); ns_end_transaction("GetMoldings", NS_AUTO_STATUS); ns_start_transaction("FramingStudio_5"); ns_end_transaction("GetFramingStudio_5", NS_AUTO_STATUS);
68
ns_start_transaction("GetFramePrice");
ns_end_transaction("GetFramePrice", NS_AUTO_STATUS); ns_start_transaction("GetFramePrice_2"); ns_end_transaction("GetFramePrice_2", NS_AUTO_STATUS); ns_start_transaction("FramingStudio_6"); ns_end_transaction("FramingStudio_6", NS_AUTO_STATUS);
69
ns_start_transaction("GetFrame_2");
ns_end_transaction("GetFrame_2", NS_AUTO_STATUS); ns_start_transaction("GetFramePrice_3"); ns_end_transaction("GetFramePrice_3", NS_AUTO_STATUS); ns_start_transaction("GetFramePrice_4"); ns_end_transaction("GetFramePrice_4", NS_AUTO_STATUS);
70
ns_start_transaction("FramingStudio_7");
ns_end_transaction("FramingStudio_7", NS_AUTO_STATUS); ns_start_transaction("GetFrame_3"); ns_end_transaction("GetFrame_3", NS_AUTO_STATUS); ns_start_transaction("FramingStudio_8"); ns_end_transaction("FramingStudio_8", NS_AUTO_STATUS);
71
CHECK POINTS
72
ADD THESE CHECKPOINTS nsl_web_find(TEXT="<title>Art.com - Posters, Art Prints, and Framed Art Leader.</title>", PAGE=AllProducts, FAIL=NOTFOUND, ID="Title Not Found", ActionOnFail=STOP); nsl_web_find(TEXT="Page 1 of", PAGE=Products, FAIL=NOTFOUND, ID="Page 1 of X Not Found", ActionOnFail=STOP); nsl_web_find(TEXT="Sort By", PAGE=Products, FAIL=NOTFOUND, ID="Sort By Not Found", ActionOnFail=STOP);
73
nsl_web_find(TEXT="FRAME IT", PAGE=Product, SaveCount=FrameItCount,);
nsl_web_find(TEXT="Sorry, this product is no longer available", PAGE=Product, SaveCount=productNotAvailable); nsl_web_find(TEXT="Congratulations - you found the perfect print...", PAGE=FramingStudio, FAIL=NOTFOUND, ID="Congratulations not found", ActionOnFail=STOP);
75
PARAMETERIZATION
76
DECLARE PARAMETER Declare parameter:- It is used for uninitialized values which is declared in script.capture as nsl_decl_var(variable name), which is further used in script.c through our API. Example:- nsl_decl_var(uiValue); nsl_decl_var(FrameItCount); nsl_decl_var(FramingStudioUrl);
78
uiValue Declare Varible
uiValue is to get session id. We are not able to get the Session id from any specific page. So we are extracting the session id through API:- ns_get_cookie_val_ex ("sessionid", NULL, NULL); Ex:- char*sessionIdValue=ns_get_cookie_val_ex("sessionid",NULL, NULL); ns_log_msg(NS_LOG_DEBUG, "Cookie sessionid value = %s", sessionIdValue); ns_save_string(sessionIdValue, "uiValue");
79
Place the code in check page of All Products page after the end of transaction.
80
FrameItCount Declare Variable
Some arts may not be available for framing . So frame it count is declared for the issue as:- nsl_decl_var(FrameItCount); nsl_web_find(TEXT="FRAMEIT",PAGE=Product, SaveCount=FrameItCount);
82
return -1; if(ns_get_int_val("FrameItCount") <= 0) {
fprintf(stdout, "Product is not available for framing.\n") ns_end_transaction("FramingStudioProduct", NS_AUTO_STATUS); return -1; }
83
If the art is not available for framing , exit the script.
Place the code in check page of Product page before the end of Transaction. If the art is not available for framing , exit the script.
84
PRODUCT NOT AVAILABLE DECLARE VARIABLE
Some Products may no longer be available . So prod not avail is declared for the issue ,as:- nsl_decl_var(productNotAvailable); nsl_web_find(TEXT="Sorry, this product is no longer available", PAGE=Product, SaveCount=productNotAvailable);
86
Place the code in check page of Product page before the end of Transaction
87
Product not available is not our fault
Product not available is not our fault . So we have ended the script with 64 error code. We have defined:- Err 64 - prod Not Avail.
88
SEARCH PARAMETER It is to parameterize the dynamic values which is generated by the server at run time. Search parameters in our script are:- Categoryurl ProductUrl FramingStudioUrl InnerDimension Width &Height MatId CropId GlassId
89
Category url Categoryurl is applied in Products page ,to extract different categories of art style . Syntax :- nsl_search_var(CategoryUrl, PAGE=AllProducts, LB="gallery/id--", RB="')\"", ORD=ANY, SaveOffset=0, Search=Body);
90
Page Dump Allproducts View Frame Source
Select LB : “gallery/id” RB : “')“” from frame source.
91
ProductUrl ProductUrl in All product page is to extract different products from the selected category. Syntax- nsl_search_var(ProductUrl, PAGE=Products, LB="/products/", RB="&ui", ORD=ANY, SaveOffset=0, Search=Body);
92
Page Dump Products View Frame Source
Select LB:- “/products/” RB:- “&ui” From frame source.
93
FramingStudioUrl FramingStudioUrl is a declare variable in FramingStudio page. We get Url either as:- javascript:launchInlineStudio('/FrameStudio/default.asp',‘ or as :- javascript:launchStudio('/FrameStudio/default.asp',‘
94
So we have applied Search var as:-
nsl_search_var(launchInlineStudioUrl, PAGE=Product, LB="javascript:launchInlineStudio('/FrameStudio/default.asp','", RB="',", ORD=1, SaveOffset=0, Search=Body); nsl_search_var(launchStudioUrl, PAGE=Product, LB="javascript:launchStudio('/FrameStudio/default.asp','", RB="',", ORD=1, SaveOffset=0, Search=Body);
95
Script.capture
96
char tmp_buf[4096]; strcpy(tmp_buf, ns_eval_string("{launchInlineStudioUrl}")); if(strcmp(tmp_buf, "")) // Not empty ns_save_string(tmp_buf, "FramingStudioUrl"); else { strcpy(tmp_buf, ns_eval_string("{launchStudioUrl}")); fprintf(stderr, "Framing Studio URL not found\n"); // return -1; } return FramingStudio;
97
Script.c
98
Search In Search Parameter
Inner Dimension Block is to get Height and Width of Frame, extracted from the Url response body, as: <InnerDimensions> <Width>24</Width> <Height>32</Height> </InnerDimensions> Ex:- nsl_search_var(InnerDimentionBlock, PAGE=FramingStudio_2, LB="<InnerDimensions>", RB="</InnerDimensions>", ORD=1, SaveOffset=0, Search=Body);
99
InnerDimensionBlock parameter
100
How to apply Search in Search parameter
Inner Dimension width& Inner Dimension height is found from the Inner Dimension Block by appling search in serach parameter . As follows:- nsl_search_var(InnerDimensionWidth, PAGE=FramingStudio_2, LB="<Width>", RB="</Width>", ORD=1, SaveOffset=0, Search=Variable, Var=InnerDimentionBlock); nsl_search_var(InnerDimensionHeight, PAGE=FramingStudio_2, LB="<Height>", RB="</Height>", ORD=1, SaveOffset=0, Search=Variable, Var=InnerDimentionBlock);
101
Add LB &RB in InnerDimensionWidth
Search in search parameter in InnerDimensionBlock as follows:-
102
script.capture
103
MatId MatId in FramingStudio_6 page is used to give the different matid of the product. Ex:- nsl_search_var(MatId, PAGE=GetMats, LB="<MatId>", RB="</MatId>", ORD=ANY, SaveOffset=0, Search=Body);
104
CropID CropId in FramingStudio_6 gives the Id for cropping the product. Ex:-nsl_search_var(cropid, PAGE=FramingStudio_2, LB="<CropId>", RB="</CropId>", ORD=1, SaveOffset=0, Search=Body);
105
GlassID GlassId in FramingStudio_6 page gives the glass id of the product in which search in search extracted from glass Block. Ex:-Extracted from the Url response body, as . <Glass> <Identification> <Application> </Application> nsl_search_var(GlassBlock, PAGE=FramingStudio_2, LB="<Glass>", RB="</Glass>", ORD=1, SaveOffset=0, Search=Body);
106
Used search in search parameter as follows:
Syntax:_nsl_search_var(GlassAppId, PAGE=FramingStudio_2, LB="<Application>", RB="</Application>", ORD=1, SaveOffset=0, Search=Variable, Var=GlassBlock);
107
Script.cature
108
SCENARIOS
109
RUNNING WITH 1 USER AND 1 SESSION
PROF_PCT_MODE NUM AUTO_REDIRECT 10 SGRP g1 NA Internet 0 ArtFramingStudio 1 TNAME Test FramingTest SCHEDULE ALL Start0 START IMMEDIATELY SCHEDULE ALL RampUp0 RAMP_UP ALL RATE 120 M LINEARLY SCHEDULE ALL Stabilize0 STABILIZATION TIME 0 SCHEDULE ALL Duration0 DURATION SESSIONS 1 SCHEDULE ALL RampDown0 RAMP_DOWN ALL IMMEDIATELY G_TRACING ALL G_MODULEMASK ALL HTTP G_DEBUG ALL 4 DEBUG_TRACE 1
110
TO CHECK PAGE DUMP Click on analysis button.
Click on your test run number.
111
PAGE DUMP Click on Page Dump option
112
CHECK FOR URL REQ/RES You can check the Status which should be “Success” and also check the Parameter substitution, Request, Request Body and Response for all the pages.
113
THANK YOU
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.