Presentation is loading. Please wait.

Presentation is loading. Please wait.

SCRIPT RECORDING AND PARAMETERIZATION [SIMPLE].

Similar presentations


Presentation on theme: "SCRIPT RECORDING AND PARAMETERIZATION [SIMPLE]."— Presentation transcript:

1 SCRIPT RECORDING AND PARAMETERIZATION [SIMPLE]

2 GOALS OF TRAINING Script GUI Script Debugging Recording
Script Structure Page Snapshots Script Testing/Debug trace Checkpoints Transactions Parameterization File 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 Scenario GUI Designing of Fixed Concurrent Scenario Start Test
                Page Think Time                 Session Pacing   Execution of scenario Start Test Monitor using Execution GUI and understand all standard graphs   Analysis            Quick analysis after test is over

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

5 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…

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

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

8 FLOW OF SCRIPT TO RECORD

9

10 PART 1 RECORDING

11 SCRIPT RECORDING Three ways to generate script are:
By Recording from GUI By nsu_gen_script from CLI By making copy of script

12 HOW TO RECORD THE SCRIPT FROM GUI
Login to a netstorm GUI from the browser. Then select script button from the GUI appeared. 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.

13 HOW TO START THE RECORDING
Go to script first

14 PRESS START RECORDING BUTTON

15 SCRIPT RECORDER WINDOW
Enter the scripts name “ToursTrainee”. 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.

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

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

18 PAGE 3 OF RECORDING Select the Departure City as “New York” and Departure Date will be default. Select the Arrival City “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.

19 SNAPSHOT OF PAGE 3

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

21 PAGE 5 OF RECORDING The 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 the Credit Card as “12345”. Enter the Exp. Date as “2014”. Click on “purchase flight” button.

22 SNAPSHOT OF PAGE 5

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

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

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

26 SAVING SCRIPT

27 RECORDED SCRIPT PAGE NAMES

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

29 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. If the change page screen gets lost, it can be changed from Edit option-> Page(s). After entering the new page names, click the change button and then the new page names will be saved.

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

31 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

32 Recorded script (ToursTrainee) will shown in script management under your project and sub project.

33 PART 2 SCRIPT STRUCTURE

34 ADDED SCRIPT FILES

35 SCRIPT FILES script.capture script.detail script.c script.h Dump File
Temp File

36 script.capture Script.capture
This file contain main url’s, headers , number of embedded url’s. It contains the main execution loop & the URLs that are accessed by NetStorm. Parameterization and Check Points are added to this file.

37 SCREEN SHOT OF script.capture

38 script.detail 2) Script.detail:
This file contain detail of embedded url’s of each page. It contains block for each page which has some additional details.

39 SCREEN SHOT OF Script.detail

40 script.c 3) Script.c: It contains init_script() and exit_script() to specify start and end of the script. pre_page function and check_page function are added for each page automatically in this file. Transactions are added in this file.

41 SCREEN SHOT OF script.c

42 script.h 4) Script.h: This file contain all the headers of a script.

43 Screen shot of script.h

44 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

45 TEMP FILE 6) Temp File: It contains:-
changed_url.txt: This file contain the url which name are parsed. logs: This file contains Script Recorder_debug.log and script_Recorder_error.log

46 PART 3 PAGE SNAPSHOTS

47 SNAPSHOTS OF RECORDED SCRIPT
Snap shot Button

48 HOME PAGE SNAPSHOT

49 WELCOME PAGE SNAPSHOT

50 FIND FLIGHT PAGE SNAPSHOT

51 SEARCH RESULT PAGE SNAPSHOT

52 PASSENGER PAYMENT DETAIL PAGE SNAPSHOT

53 FLIGHT CONFIRMATON PAGE SNAPSHOT

54 LOGOUT PAGE SNAPSHOT

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

56 REQ/RES FROM SNAP SHOT

57 PART 4 SCRIPT TESTING

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

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

60 DEBUG LOG

61 PART 5 TRANSACTIONS

62 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 do by the user. Transactions are added by using following API: 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.  

63 AUTO STATUS 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.

64 TRANSACTION IN GUI Go to the Script management and double click on script.c file. It should be noted that start transaction should be the first statement within pre_page function block, so take the pointer at that line to insert the start transaction. It should be noted that end transaction should be the last statement, just before the return statement of check_page function block, so take the pointer at that line to insert the end transaction. Ways to put transactions: Click on File option -> Insert -> Start/End Transaction. Right Click on script.c file, Select Insert -> Start/End Transaction.

65 TRANSACTION FROM FILE BUTTON

66 TRANSACTION FROM SCRIPT.C FILE

67 START TRANSACTION (HOME PAGE)

68 START TRANSACTION ADDED

69 END TRANSACTION

70 END TRANSACTION (HOME PAGE)

71 TRANSACTION ADDED (HOME PAGE)

72 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);

73 OTHER PAGES TRANSACTIONS
ns_start_transaction("SelectFlight"); ns_end_transaction("SelectFlight", NS_AUTO_STATUS); ns_start_transaction("FlightConfirmation"); ns_end_transaction("FlightConfirmation", NS_AUTO_STATUS); ns_start_transaction("Logout"); ns_end_transaction("Logout", NS_AUTO_STATUS);

74 PART 6 CHECK POINTS

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

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

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

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

79 CHECK POINTS FROM FRAME SOURCE

80 FRAME SOURCE OF HOME PAGE

81 INSERT CHECKPOINTS

82 CHECKPOINT PARAMETER WINDOW
Click “Add” button to add checkpoints.

83 ADD CHECK POINT WINDOW

84 CHECKPOINTS nsl_web_find(TEXT="<title>Mercury Tours</title>", PAGE=Home, PAGE=Logout, FAIL=NOTFOUND, ID="Home/ Logout page 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);

85 CHECKPOINTS nsl_web_find(TEXT="<title>Search Results</title>", PAGE=SearchResults, FAIL=NOTFOUND, ID="SearchResults page not found", ActionOnFail=STOP); nsl_web_find(TEXT="Please enter the passenger and payment details", PAGE=PassengerPaymentDetail, FAIL=NOTFOUND, ID="Passenger Payment page 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);

86 CHECK POINTS ADDED

87 CHECKPOINTS PLACE Make sure that your checkpoints should be added in the capture file of your recorded script And between the block of //Define Any NS Variables here. Do not remove or modify this line and //End of NS Variable declarations. Do not remove or modify this line

88 PART 7 PARAMETERIZATION

89 PARAMETERIZATION 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 capture file. NS Variable value is accessed by putting its name within curly braces ({}).

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

91 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 capture file.

92 FILE PARAMETER File parameter:-
It is used to take values from the file created by the user in the script. In file parameter you have to define a parameter name and that parameter name can be used in Url’s, Header and Body.

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

94 Create new File Button

95 ADDING NEW FILE Write File Name as “UserNamePassword”

96 Write usernames and passwords separated by , in UserNamePassword file and save the file.

97 Now go to capture file by double clicking on capture file and right click to insert the file parameters.

98 FILE PARAMETER WINDOW

99 ADD FILE PARAMETER WINDOW

100 FILE PARAMETERISE ADDED

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

102 PARAMETERISE THE VALUE

103 SEARCH PARAMETER Search parameter:-
It is used to search a particular pattern by giving it Left Boundary (LB) and Right Boundary (RB).

104 HOW TO ADD SEARCH PARAMETER
Go to snap shots of your recorded script from script management. Click on first page “Home” 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 capture file of your recorded script. Right click on this file contents and select Parameters->Search Parameters to add the search parameter.

105 Right click on capture file & go to search parameter

106 SEARCH PARAMETER WINDOW
Click on add button to add search parameter.

107 ADD SEARCH PARAMETER WINDOW

108 SEARCH PARAMETER ADDED

109 SEARCH PARAMETER ADDED
nsl_search_var(SessionId, PAGE=Home, LB="name=userSession value=", RB=">", ORD=1, SaveOffset=0, RedirectionDepth=Last, Search=Body);

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

111 PARAMETERISE THE VALUE

112 PART 8 SCRIPT DEBUGGING

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

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

115 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 ToursTrainee.conf Enter all the necessary keywords , as below.

116 RUNNING WITH 1 USER AND 1 SESSION
PROF_PCT_MODE NUM AUTO_REDIRECT 10 0 SGRP g1 NA Internet 0 ToursTrainee 1 TNAME Test Tour Trainee 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

117 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 ToursTrainee 1 “g1”is the group name, user profile is “Internet” , type is Script which is shown by “0”, ToursTrainee is the Session Name and user is 1. TNAME Test Tour Trainee It is the Test Name.

118 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

119 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 G_DEBUG ALL 4 G_MODULEMASK ALL HTTP & G_DEBUG ALL 4 keywords are used for enabling Level 4 debug logs with HTTP modules. DEBUG_TRACE 1 It creates the debug_trace.log file.

120 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/ToursTrainee.conf

121 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

122 TO CHECK PAGE DUMP Click on analysis button.
Click on your test run number.

123 PAGE DUMP Click on Page Dump option

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

125 PART 9 SCENARIO GUI

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

127 SCENARIO SETTING WINDOW

128 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 “ToursTrainee” and Quantity

129 SETTING DURATION Double click on “Duration” phase type and now set the duration of scenario for 10 minutes

130 SELECT RAMP DOWN OPTION

131 RAMP DOWN WINDOW Ramping down 5 user per minute.

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

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

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

135 PART 10 EXECUTION OF SCENARIO

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

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

138 MONITORING GRAPHS Click “Execution” from Netstorm tool bar and monitor graphs of your test run. We can also check Test output, Event Log and Transaction Details.

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

140 ANALYSIS Analysis GUI requires lots of analysis for test run which is not included in this tutorial.

141 THANK YOU


Download ppt "SCRIPT RECORDING AND PARAMETERIZATION [SIMPLE]."

Similar presentations


Ads by Google