What are the Challenges that you face during scripting?
Ans: Challenges faced on the scripting:
Using the file functions in the scripting of Vugen
Using of the randomization techniques in scripting
Handling the correlation for the .Net and java applications like view state, even validation, session id etc.
Default: while trying to correlate the record items (each record has at least 20 fields) the boundaries of fields are changing dynamically, and there is no specific pattern for boundaries.
Example: 1-4611378121*21HealthandWelfare10*Phone
Call1*05*Hutch2*HW7*Inquiry0*4*TEST5*COBRA19*0
If we want to capture ---> the boundaries of Hutch are changing dynamically without any specific pattern.
Solution: To the above problem we are explicitly capturing the entire record and storing into the parameter array.
//*1-4819497423*HRO3*ODM1*15*Hutch7*Payroll11*Transaction0*5*ALBEE12*
web_reg_save_param("Record","LB/DIG=*#-#####","RB/DIG=*#-#####","ORD=1", LAST);
The entire record is captured into array “Record”, now we are explicitly matching the field values, by writing some code logic it will take the first value, and using StringCheck function whenever the value is not matched StringCheck function will return a null pointer. Once the value is matched, the matched value will be send as field input to server.
Pros: The logic will handle dynamic record changes And Script maintenance is less.
Cons: All the field values should be statically kept into pointer array.
Ex: char* LastnameArray [] = {"ALBEE","ADKINS","TEST","ADELMUND","Hutch1"};
Memory utilization is high.
Scenario 1: How to use a C string in a VuGen request
So, we have to declare and define a string as shown below
char sPlanName[] = " MyFinancialPlan ";// The ‘sPlanName’ is a C string and hence we need to convert it into LR string.
We do this using ‘lr_save_string’ function as shown below:
lr_save_string(sPlanName,”LRPlanName”);
Scenario 2: How to convert a load runner variable to C integer
if(atoi(lr_eval_string("{WelcomeCount}"))>0)
this parameter has to be converted into C string first and then to C integer. ‘lr_eval_string’ and ‘atoi’ functions are used (respectively).
File operations:
char buffer[1000]; //The buffer to store the read data stream
char *filename = "C:\\Temp\\mysamplefile.txt"; /* name and path of the file to be read from */
char * accessmode = "r"; /* access mode r /r+ = open for reading , w /w+ = open for writing ,a /a+ = open for appending */
/* "+" sign indicates that the file must already exist */
long filepointer; /* declaring a file pointer */
int count=500; /* number of bytes to be read */
filepointer = fopen(filename, accessmode); /* open file in read mode */
fread (buffer,sizeof(char),count,filepointer); /* read from output file */
lr_save_string(buffer,"requestbody"); //we can use this as a LR parameter and can use in the script now
fclose(filepointer); //close the file pointer
How to write and use a function in a VuGen script
function in a VuGen script can be written inside any action, it is generally written inside the ‘globals.h’ file (under the Extra Files section of the VuGen script) or inside a newly created file (under the same ‘Extra Files’ section). Once written, the function can be called from any Action(s).
=====
Vugen Not Recording — Internet Explorer (iexplore.exe) “Hangs” when launched during recording
Solution:
This may occur due to COM object permission.
1.Change the following Recording Options setting:
“Recording Options->General->Script”: UN-CHECK “Track processes created as COM local servers”
Then record the WEB (HTTP/HTML) script..
Error -26547: Authentication required, please use web_set_user, e.g. web_set_user(“domain\\user”, “password”, “host:port”);
Solution:
Even for some web services there is no security certificate but there is authorizationYou have to get the authorization username and pass word and add in the web_set _user as at the top of the script.
Ex: web_set_user(“domain\\username”,”password”,”host:port”);
If it is a basic authentication no need to use domain
web_set_user(“username”, “password”, “host:port”);
if the authentication is either NTLM or Digest then you must manually insert web_set_user into the script, including user and password information, to authenticate the Vuser to the Web server.
With NTLM authentication, you must prepend the domain name and a double backslash to the user name: “[domain_name]\\[username]”.
For Ex: web_set_user(“domain\\username”, “password”, “url:80/443”);
API requires either 2-way SSL/TLS, (or) 1-way SSL/TLS with BASIC credentials.
Error -26628: HTTP Status-Code=403 (Forbidden) for Url
Solution:
The primary solution for this error will be checking these 2 calls in the script
web_set_sockets_option(“SSL_VERSION”, “TLS”);
web_set_user(“USERNAME”,”PASSWORD”,”URL……………:443″);
please check with the development team for the security certificate.
After getting that certificate from dev team, please add in the extra files in the load runner
Additionally we can use this 2 functions for security
web_set_certificate and web_set_certificate_ex
Error: Failed to retrieve output arguments/checkpoints – SOAP fault occurred
Solution :
The reason for the SOAP fault is: “SOAP Security Header Username Token” is required for operation
Please add web_add_header with username token input can resolve this issue.(get from development team)
Use below info to add header info
web_add_header(“Username token”,” ……………….”);
After placing the header info script passed successfully
--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
PC/Controller Error : The user files were not transferred to the local load generator
While running Vusers in the PC/ Controller the user receives the following errors:
Error: “82000 One or more of the script’s files have illegal names. It is possible that two files are using the same name and directory.”
Error: “84805 The user files were not transferred to the local load generator”
The scripts run fine on the local host but experience the above error while trying to run on a remote machine
Solution:
This errors occur when there is a mismatch of parameter data file path in loadrunner and in .prm file.
Ex: let us assume your parameter file as p_Username.dat in loadrunner script , but if you see in that .prm file the table name entry will be “Table=p_username.dat” so because of this your parameter file will not be loaded to your LG.
[parameter:p_password]
Delimiter=”,”
ParamName=”p_password”
TableLocation=”Local”
ColumnName=”p_password”
Table=”p_username.dat”
GenerateNewVal=”EachIteration”
Type=”Table”
value_for_each_vuser=””
OriginalValue=”sample”
auto_allocate_block_size=”1″
SelectNextRow=”Same line as p_username”
StartRow=”1″
OutOfRangePolicy=”ContinueWithLast”
[parameter:p_username]
Delimiter=”,”
ParamName=”p_username”
TableLocation=”Local”
ColumnName=”p_username”
Table=”p_username.dat”
GenerateNewVal=”EachIteration”
Type=”Table”
value_for_each_vuser=”1″
OriginalValue=”sample”
auto_allocate_block_size=”0″
SelectNextRow=”Unique”
StartRow=”1″
OutOfRangePolicy=”ContinueWithLast”
The Best solution is to check files before load test and use small case for the parameter file which will eliminate this issue.
1. Make sure that all the parameters referencing the same parameter file use the same case for the file name/file path when it is being added to the script. If the case for the parameter file name/file path differs, it might causes problems.
2.Make sure that the ScriptName.prm file references the parameter in the script in correct case. If not, it might cause problems.
3.Make sure that there are no spaces in the parameter file names. Embedded spaces will work for VuGen but not for PC.
==============
Issue :-
Project or Test has been locked by user in Performance Center
The following error has been seen so many times during Test Scenario saving or running tests.
“Project or Test has been locked by user in Performance Center”
This is because test has not been saved completely or user might have clicked on other elements during scenario saving. this will prevent other users to access the scenario by saying message “Project or Test has been locked by user”
Steps to resolve that issue
Copy the existing test plan in PC and paste in the same folder or different folder
Rename to some new name and try to run it.
================
Authentication required, please use "web_set_user" solution not working
Ans : Actually, this line does nothing:
web_set_user("localhost\\jojo", "bean", "localhost:1080");
You are trying to use a user for local host but that doesnt make any sense.
Your error message can come from 2 places:
The site requires authentication.
You are behind a proxy which requires authentication.
If you are using a proxy server under run-time settings, please fill in your user and password for proxy authentication.
If you are not using a proxy, you need to provide the remote site your password, not localhost. try changing the web_set_user command to:
web_set_user("<domain name>\\<user in domain>", "<password>", "<site address server name>:80");
(or)
web_set_user("<domain name>\\<user in domain>", "<password>", "<site address server name>:8080");
For example:
web_set_user("IAN_Net\\james", "bobo1", "MercuryTours.com:8080");
web_set_user("IAN_Net\\james", "bobo1", "localserver:8080");
web_set_user("IAN_Net\\james", "bobo1", "10.2.33.222:8080");
web_set_user("IAN_Net\\james", "bobo1", "10.2.33.222:80");
=====================
How do I import TestData from csv file into Vugen Script
You can import CSV file and use it as a data file for parameterization.
Follow the steps as mentioned below:
Select the value you want to parameterize. for an explanation, I took username field (jojo).
Right click on the value (jojo) -> select Replace With Parameter -> select Create New Parameter
Write Parameter name as username (any name of your choice) -> select parameter type as File -> Click OK button.
Select Yes/No for "Do You want to replace all occurrences" based on your need.
The value (jojo) will be replaced as {Username}. Username.dat file will be created with only one entry in the file i.e., jojo
Right click on {Username} -> select Parameter Properties -> click Browse button under File Type -> Select the CSV file (Users.csv) you want to import (select Save as type -> All Files (.*) in Save As dialogue box).
Parameter Properties dailougue box shows all the entries in the csv file in tabular format.
under Select Column, select By name radio button -> from dropdown, select "username" (column header) -> click Close
Repeat the actions for each column in the CSV file, wherever you want to replace the values with data in CSV (column header is the key).
Second iteration:
For password parameter, I followed the same process, given the name parameter name as "Password", and selected the same CSV file, under refer the data "By name" -> Password (column header)
Screenshot for Password parameter:
How to solve GWT issue in Performance Testing.
Before going into detailed of GWT issues. I would like to brief about what exactly GWT mean for Performance Testing.
What is GWT-RPC (Remote Procedure Call):
GWT (Google Web Tool), It is a development toolkit to develop a complex browser-based applications. Many projects prefer it because of its free availability. Along with its open source characteristics it adds many secure features too.
GWT- based website works on GWT-RPC mechanism, when we record GWT based web application without enabling DFE support the resulting request body contents significant amount of data which is not a human readable.
While recording such application in Vugen we get request body in below format:
Recorded request:
TIP to identify GWT: In the record body we are able to see- The body part had many piped between different requests, such recording generally could be because of GWT-based web sites.
After recording, we can also see a message in Error tab as-
Replayed Errors:
> The warning message which come in Warning BOX:
How to solve it:
> Our first and main objective should to serialised the binary recorded code. By doing that, the binary type code will become in html format, which would be easily readable too.
> Then we can go ahead for correlations and required parameterization.
Serialisation:
> For serialisation We required a single .war file or if it is not available then we have to use following .jar files. We can demand Application developer to provide such required files
>> “.gwt.rpc” file
>> “.jar ” files
>> “.class” files
> There is two ways to get serialised code request–
1. Before recording we can use these .war/.jar files and
2. After recording -For this we need to customize DFE (Data Format Extension), then re-generate the script.
> For serialisation We need to have prior knowledge of DEF feature- Kindly refer below link for more details on DFE features. Link–
Guidelines- how to use DFE feature for Serialisation
A). Open Recording option– (Vugen–> File–> Recording Option)
B). Go to Data Format Extension – Add New Chain from Chains box like- PT_GWT.
C). Adding DFE feature
C). Add New chain from Chain: gwt table– After clicking on green colored + simbol -Add Data format Extension window has to open.
D). After addition of GWT extension– double click on the same text or click on edit DFE (right behind of green colored + simbol).
Note: If we have .war file then select add files button and give the location of file. If we have
>> “.gwt.rpc” file
>> “.jar ” files
>> “.class” files
Then we need to add a folder to add .gwt.rpc, then–> Add file and select all relevant .jar files & .class files
E).Then, go back and open Code Generation from Data Format Extension- Here select Body, for body, assign the appropriate Chain (if you have already other existing chain) from drop-down.
After generating the script using GWT DFE, we will get a readable LoadRunner API that includes the request inside an XML. All the pipe signs will be replaced with meaningful key and values that were captured in the transport level.
Advise– If any request which is getting recorded in piped format inside the body, it does not mean without serialisation or without .jar/.war file correlation is not possible. The fact is it is absolutely possible, but it require to identify the correct Dynamic values for correlations.














No comments:
Post a Comment