Presentation is loading. Please wait.

Presentation is loading. Please wait.

SCRIPT RECORDING [webc mode].

Similar presentations


Presentation on theme: "SCRIPT RECORDING [webc mode]."— Presentation transcript:

1 SCRIPT RECORDING [webc mode]

2 GOALS OF TRAINING Script GUI(WEBC MODE) Script generation from CLI
Recording Script Structure Page Snapshots Script Testing/Debug trace Script generation from CLI                            

3 Hpd TOURS Its is a dummy application which is used for recording.
It acts as a real world application in which the following is done: Sign in where username and password can be anything. Search for a flight to desired destination. Search results are displayed and then any option is chosen. Confirm the flight, give the payment details and then logout.

4 PREREQUISITE Internet Explorer Version 6.0 or higher
Http Analyzer version 5.0 Netstorm Machine IP And Port number. Login Name And Password accordingly with the IP using. NetOcean IP where Hpd Tours application runs. Continued…

5 If you have Windows Vista OR Windows 7 then you have to disable protected mode of IE for recording. 
To disable this on IE go to Tools->Internet option ->Security Tab->Select Internet->Uncheck Enable Protected Mode option as shown.

6 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.

7 FLOW OF SCRIPT TO RECORD

8

9 PART 1 RECORDING

10 SCRIPT RECORDING Two ways to generate script are:
By nsu_gen_cscript from CLI By Recording from GUI

11 Procedure To Generate Script From CLI
Create an input file named as 1xx.inp. Command for creating filevi 1xx.inp

12 Do following entries in the file 1xx.imp
Enter 1 for Main Url & 2 for Embedded url. Enter the Http method like (GET , HEAD , POST etc) Enter the URL. Example: 1 GET 2 GET

13 Command for genrating c script from CLI
nsu_gen_cscript -s <ProjectName/SubProjectName> <ScriptName> -F <flowName> -f <InputFileName> Let ::ProjectNameQAT_Trainee SubProjectNameTrainee ScriptNamescript_c FlowNameflow_one InputFileName1xx.inp

14 Then the command used at CLI to create script in WEBC mode will be::
nsu_gen_cscript –s QAT_Trainee/Trainee script_c –F flow_one –f 1xx.inp Script will be recorded at path:: home/netstorm/work3/scripts/QAT_Trainee/Trainee/script_c

15 HOW TO RECORD SCRIPT FROM GUI
Login to netstorm GUI from browser. Then select script button from GUI. Click on start button and start recording. First pop up window will open where you have to give Script name, Url, Project and Sub project Name,Protocol Category(as WebC).

16 HOW TO START RECORDING Go to script first

17 PRESS START RECORDING BUTTON

18 SCRIPT RECORDER WINDOW
Enter the script name “script_web_c”. Enter the URL. Enter the project name & sub project name Either you can choose Project-default,SubProject-default or Contact the Admin to create your own project or subproject Add name of the flow

19 SCRIPT RECORDER WINDOW

20 Add The Name Of The Flow

21 PAGE 1 OF RECORDING Enter member name “hello” and password “world” and click on “login” button.

22 PAGE 2 OF RECORDING Click on “flights” button to find the flight.

23 PAGE 3 OF RECORDING Select Departure City as “New York” and Departure Date will be default. Select Arrival City as “Paris” and Return Date will be default. Enter No. of Passengers as 2. Select Seating Preference as “Window”. Select Type of Seat “Coach”. Click on “continue…” button.

24 SNAPSHOT OF PAGE 3

25 PAGE 4 OF RECORDING Select third option for Flight.
Click on “continue…” button.

26 PAGE 5 OF RECORDING First Name is “Tiger” and Last Name is “Scott” which are default values. Street Address and City/State/Zip are set by default. First name of Passenger Names is “Scott Tiger” which is default and enter second Passenger Name as “Red Bull”. Enter Credit Card as “12345”. Enter Exp. Date as “2014”. Click on “purchase flight” button.

27 SNAPSHOT OF PAGE 5

28 PAGE 6 OF RECORDING This is flight confirmation page.
Click on “signoff” button on left side to logout.

29 PAGE 7 OF RECORDING This is logout page which confirms that you have successfully logout.

30 FINISHING THE RECORDING
To finish recording click ‘stop’ button on script management window which will save the script. Stop Recording Button

31 SAVING SCRIPT

32 RECORDED SCRIPT PAGE NAMES

33 PAGES NAMES Above are the default page names which comes automatically from Query String, selecting only the last part of the URL. If two pages have same name then it will be differentiated by pagename_2 for second page, pagename_3 for third page and so on. Example: -FindFlight - FindFlight_2 - FindFlight_3, of recorded script.

34 Its highly recommended to change the page name after recording .
If page names are changed after parameterization or check points it’s a limitation of product that it will not reflect changes in script. Change Page Name GUI can be opened from Edit option-> Page(s). After entering new page names, click change button and then new page names will be saved.

35 NEW PAGE NAMES By clicking on change button we can change the name of pages

36 PassengerPaymentDetail
You can directly copy the names from this table to change the pages names. Old Page Names New Page Names index_html Home login Welcome reservation FindFlights findflight SearchResults findflight_2 PassengerPaymentDetail findflight_3 FlightConfirmation welcome Logout

37 Recorded script (scripts_web_c) will be shown in script management under your project and sub project.

38 Add Another Flow In The Same Script
Give url and new flow name “flow2” Click here reCORD NEW FLOW AS DESCRIBED ABOVE AND SAVE IT

39 PART 2 SCRIPT STRUCTURE

40 SCRIPT FILES exit_script.c flow1.c
flow2.c (initially only one flow is generated during recording but multiple flow can be added) init_script.c registration.spec runlogic.c

41 ADDED SCRIPT FILES

42 flow1.c All main and embeded urls are shown on this page.
Following are added on this page Page think time Transactions Check points

43 Screen Shot Of flow1.c

44 Screen Shot Of init_script.c
Any declaration can be done here. Transactions can be applied here.

45 Registration.spec We define all parameters at this page:
Such as: File Parameter Search Parameter Random String Parameter Index File Parameter Declare Parameter Random Number Parameter XML Parameter Date Time Parameter Unique Parameter

46 Screen Shot Of registration.spec

47 Screen Shot Of runlogic.c
Flows of the scripts can be ordered here.

48 Screen Shot of exit_script.c

49 DUMP FILE 5) Dump File: It contains:-
Header file: It contains the request and response of each pages. Index file: It contains URL’s of all the pages. Pages.html PagesList.html

50 TEMP FILE 6) Temp File: It contains:-
changed_url.txt: This file contains the url whose names are parsed. logs: This file contains Script Recorder_debug.log and script_Recorder_error.log

51 PART 3 PAGE SNAPSHOTS

52 SNAPSHOTS OF RECORDED SCRIPT
View Snap shot Button

53 HOME PAGE SNAPSHOT

54 WELCOME PAGE SNAPSHOT

55 FIND FLIGHT PAGE SNAPSHOT

56 SEARCH RESULT PAGE SNAPSHOT

57 PASSENGER PAYMENT DETAIL PAGE SNAPSHOT

58 FLIGHT CONFIRMATON PAGE SNAPSHOT

59 LOGOUT PAGE SNAPSHOT

60 REQ/RES FROM SNAP SHOT Click on page number of each page from snapshot to check the request and response of each page. You can check the main url’s which are followed by the embedded url’s.

61 REQ/RES FROM SNAP SHOT

62 PART 4 SCRIPT TESTING

63 NEED OF SCRIPT TESTING Script Testing is useful for quick test of recorded script. By Script Testing you can easily look at the flow, how script is recorded. It should be noted that Script testing is not meaningful for those scripts which are taking dynamic values. Example account no., username and password etc.

64 Go to script management and click “Test Script” button to test the script which you have recorded.

65 DEBUG LOG

66 TRANSACTIONS Any sequence of page clicks may be grouped as a transaction. Transactions are added to measure the response time of a particular logical action done by the user. Transactions are added by using following APIs: ns_start_transaction(“transaction name”);  It acts as a marker to define the start of a transaction. ns_end_transaction(“transaction name”,status);  It acts as a marker to define the end of a transaction.

67 AUTO STATUS In the End Transaction, you should use Auto Status as this will set the status of transaction based on the status of last page which is part of that transaction. If transaction need to be failed, then use error status.

68 TRANSACTION IN GUI Go to the Script management and double click on flow.c file. Ways to put transactions: Click on File option -> Insert -> Start/End Transaction. Right Click on flow.c file, Select Insert -> Start/End Transaction.

69 TRANSACTION FROM FILE BUTTON

70 TRANSACTION FROM FLOW.C FILE

71 START TRANSACTION (HOME PAGE)

72 START TRANSACTION ADDED

73 END TRANSACTION

74 END TRANSACTION (HOME PAGE)

75 TRANSACTION ADDED (HOME PAGE)

76 OTHER PAGES TRANSACTIONS
Similarly transactions for other pages, ns_start_transaction("Login"); ns_end_transaction("Login", NS_AUTO_STATUS); ns_start_transaction("Flights"); ns_end_transaction("Flights", NS_AUTO_STATUS); ns_start_transaction("FlightResults"); ns_end_transaction("FlightResults",NS_AUTO_STATUS);

77 PART 6 CHECK POINTS

78 CHECK POINT It is very critical to have check points to make sure that we are getting right responses. Check Points can be: Positive check point: Searching for expected string. Negative check point: Searching for string which is not expected.

79 FINDING CHECK POINT Different ways of finding Check Point:
Selecting snap shot option from tool bar, will display all pages and then find the unique string for every page. Selecting snap shot option from tool bar, will display all pages and then go to page/frame source to find unique string. Going through dump folder from the script.

80 HOW TO FIND CHECK POINTS
Go to snap shots options from tool bar Select the page : Right click on frame source/page source Select the unique text which lies only on that page Ex: <title> Mercury Tours </title>

81 MATCH TEXT FOR CHECKPOINTS
There are two options to match the text for checkpoints, which are : Search for specific Text: Select that string which is unique for the page. Search for Text by start and end of string: Select the string whose value is changing dynamically for the page.

82 CHECK POINTS FROM FRAME SOURCE

83 FRAME SOURCE OF HOME PAGE

84 INSERT CHECKPOINTS

85 CHECKPOINT PARAMETER WINDOW

86 ADD CHECK POINT WINDOW Click on OK button

87 ANOTHER CHECKPOINT

88 ADD CHECKPOINT

89 FRAME SOURCE OF FLIGHTCONFIRMATION PAGE

90

91 CHECKPOINTS nsl_web_find(TEXT="<title>Mercury Tours</title>", PAGE=Home, FAIL=NOTFOUND, ID=“ Text not found", ActionOnFail=STOP); nsl_web_find(TEXT="Using the menu to the left, you can search for new flights to book.", PAGE=Welcome, FAIL=NOTFOUND, ID="Welcome page not found", ActionOnFail=STOP); nsl_web_find(TEXT="<title>Find Flights</title>", PAGE=FindFlights, FAIL=NOTFOUND, ID="FindFlights page not found", ActionOnFail=STOP);

92 CHECKPOINTS nsl_web_find(TEXT="<title>Search Results</title>", PAGE=SearchResults, FAIL=NOTFOUND, ID="SearchResults page not found", ActionOnFail=STOP); nsl_web_find(TEXT=“<title>Method of Payment</title>", PAGE=PassengerPaymentDetail, FAIL=NOTFOUND, ID=“Detail not found", ActionOnFail=STOP); nsl_web_find(TEXT="Your reservation has been confirmed. Thank you for booking through Mercury Tours.", PAGE=FlightConfirmation, FAIL=NOTFOUND, ID="FlightConfirmation page not found", ActionOnFail=STOP);

93 CHECK POINTS ADDED

94 CHECKPOINTS PLACE Make sure that your checkpoints are added in registration.spec file of your recorded script

95 PART 7 PARAMETERIZATION

96 PARAMETERIZATION Parameterization is a technique to change the value of the variable at run time. It is achieved through the use of NetStorm variables. Primary use of the NS variables is to parameterize the web_url function in the flow file. NS Variable value is accessed by putting its name within curly braces ({}).

97 TYPES OF PARAMETERS File Parameters. Search Parameters.
Declare Parameters: Not included in this tutorial. Xml Parameters : Not included in this tutorial

98 PARAMETERIZATION In this recorded script we will do two type of parameterization: File Parameterization: We will parameterize username and password. Search Parameterization: We will parameterize user session id. We will parameterize them by replacing there values with parameters name within curly braces in registration file.

99 FILE PARAMETER It is used to take values from a file created by the user in script. In file parameter you have to define a parameter name and that parameter name can be used in url, Header and Body.

100 HOW TO ADD NEW FILE To add new file :
Select add file button from tool bar, it will add file in the script structure. Add file from CLI which can be any where either in absolute or relative path.

101 Create New File Button

102 ADDING NEW FILE Write File Name as “UserNamePassword”

103 Write usernames and passwords seperated by , in UserNamePassword file and save this file

104 Now goto registration file by double clicking on registration file and right click to insert the file parameters.

105 FILE PARAMETER WINDOW

106 ADD FILE PARAMETER WINDOW

107 FILE PARAMETER ADDED

108 HOW TO PARAMETERISE Go to the url where username=hello and password=world is written in file. Replace hello with {User} Replace world with {Pass}

109 PARAMETERISE THE VALUE

110 SEARCH PARAMETER It is used to search a particular pattern by giving it Left Boundary (LB) and Right Boundary (RB).

111 HOW TO ADD SEARCH PARAMETER
Go to snap shots of your recorded script from script management. Click on second page “Welcome” Right click on this page snap shot to view the frame source of this page. Select “name=userSession value=” to copy this string as Left Boundary for search parameter from this frame source. Now, go to script management and double click on registration.spec file of your recorded script. Right click on this file contents and select Parameters->Search Parameters to add the search parameter.

112 Right click on registration file & go to search parameter

113 SEARCH PARAMETER WINDOW

114 ADD SEARCH PARAMETER WINDOW

115 SEARCH PARAMETER ADDED

116 SEARCH PARAMETER ADDED
nsl_search_var(SessionId, PAGE=Welcome, LB="name=userSession value=", RB=“>”, RETAINPREVALUE=“YES”);

117 HOW TO PARAMETERISE SESSION ID
Go to the flow1.c file and search the url where “userSession=” value is written. Replace “userSession=” value with {SessionId}

118 PARAMETERISE THE VALUE

119 PART 8 SCRIPT DEBUGGING

120 SCRIPT DEBUGGING Check points Transactions Parameterization
Checking the script is working correct or not after applying : Check points Transactions Parameterization

121 HOW TO CREATE NEW SCENARIO
Scenario can be created from CLI. Also it can be created from netstorm GUI.

122 CREATING NEW SCENARIO FROM CLI
First login to netstorm machine from CLI. Change directory to work , by: cd work For scenario move to scenario directory and then to corresponding Project and Subproject, Ex: cd scenario/Training/Scripts Create new scenario, by : vi script_web.conf

123 RUNNING WITH 1 USER AND 1 SESSION
PROF_PCT_MODE NUM AUTO_REDIRECT 10 0 SGRP g1 NA Internet 0 script_web_c 1 TNAME Test script_web 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

124 BRIEF DESCRIPTION OF SCENARIO
PROF_PCT_MODE NUM PROF_PCT_MODE is a keyword which distributes users across group, NUM shows that it is distributing users By number. Other options are:- By percentage or Auto mode. AUTO_REDIRECT 10 0 It shows the depth for redirection of page. As we are using search parameter & it takes redirect depth=last by default. SGRP g1 NA Internet 0 script_web_c 1 “g1”is the group name, user profile is “Internet” , type is Script which is shown by “0”, script_web_c is the Session Name and user is 1. TNAME Test script_web It is the Test Name.

125 BRIEF DESCRIPTION OF SCENARIO
SCHEDULE ALL Start0 START IMMEDIATELY It means start immediately after scenario begin. SCHEDULE ALL RampUp0 RAMP_UP ALL RATE 120 M LINEARLY User’s ramps linearly with users getting created at a constant inter arrival time at rampup rate of 120 virtual users per minute. SCHEDULE ALL Stabilize0 STABILIZATION TIME 0 This is for stabilizing users . SCHEDULE ALL Duration0 DURATION SESSIONS 1 This is to run the scenario for duration session 1

126 BRIEF DESCRIPTION OF SCENARIO
SCHEDULE ALL RampDown0 RAMP_DOWN ALL IMMEDIATELY Virtual users are ramping down immediately before finishing the test. G_TRACING ALL This is for showing page dumps. G_MODULEMASK ALL HTTP Request & response links will available in page dump under columns Req, RepBody and Rep G_DEBUG ALL 4 Keywords are used to enable debug log

127 HOW TO START SCENARIO Scenario can be started from scenario GUI, by selecting your scenario from the list. Also scenario can be started from CLI, by: nsu_start_test –n Project/Sub-Project/ScenarioName Ex: nsu_start_test –n Training/Script/script_web.conf

128 HOW TO FIND TEST RUN NO. You can find the Test Run No. of your running scenario by following ways: Go to Analysis from the Netstorm GUI and find your Test Run no. by checking your Project, Subproject and Test Name. Or find the Test Run no. of running scenario from CLI by this command: cat /etc/test_run_id

129 TEST RUN NO.

130 Check the checkbox & click View Reports button

131 PAGE DUMP Click on Page Dump link

132 CHECK FOR URL REQ/RES

133 PART 9 SCENARIO GUI

134 ADDING NEW SCENARIO FROM GUI
Select the Project and Subproject of your Recorded script , for example Training, Script and write the Scenario name as script_web and click on create button.

135 CREATE SCENARIO

136 EDIT SCENARIO

137 SCENARIO SETTING WINDOW

138 ADDING GROUP & NO. OF USERS
To add the group click on “Add Group” button and write Group Name as “g1”, User Profile as “Internet”, Type as “Script” , Session/URL as “script_web_c” and Quantity as “10”

139 RAMP UP SETTING Double click on “RampUp” phase type and set the ramp up from the given options. Here users are ramped up “simultaneously”

140 SETTING DURATION Double click on “Duration” phase type and now set the duration of scenario for 20 seconds

141 RAMP DOWN SETTING Double click on “RampDown” phase type and set the ramp up from the given options. Here 5 users are ramped down per 10 sec

142 FIX CONCURRENT USER Go to Global Settings, “Fix Concurrent Users” is set by default.

143 PAGE THINK TIME Go to Group Based Settings ,click on “Think Time” and select “Random (Internet type distribution) think time with median of  2 seconds”

144 SESSION PACING Click on Session Pacing ,select “After the previous session ends” option & write 2 seconds for fixed delay.

145 PART 10 EXECUTION OF SCENARIO

146 Click on “Start scenario” button to start the scenario.

147 STARTING SCENARIO Write the Test Name as “script_web” and click on “Start Scenario” button to start the scenario.

148 Following graph represents HTTP request for 1 user and 1 session

149 REPORTS GENERATED Go to “Analysis” from Netstorm tool bar and click on your Test Run no. Check the Summary Report , Page Dump & Progress Report.

150 THANK YOU


Download ppt "SCRIPT RECORDING [webc mode]."

Similar presentations


Ads by Google