Performance Testing Using Web services
Web Services
Web Services are mainly two types
- Soap Services
- Rest Services
We will see brief about Soap Services first
SOAP Prerequisites:
- End Point URL from the client
- Soap tool
- Test Data from the project team
“Country info service” SOAP Web service is considered for the below demonstration.
- End Point URL is http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
- Just verify the url in the browser it is working fine or not
2.SOAP Tool
Validate the WSDL file in Soap tool >> Open the SOAP Tool
3.Click On Project >> New Project >> Create new SOAP Project >> Provide the end point url over there.
After validating the End point url in the soap tool you will get services like below
Pick One of the Service from the list
Note: Before selecting the services you must know the Test Data from the project team or Developer
For this instance I am selecting Capital City
In the place of ? we have to insert the test data
4.Test Data from the project team
Test Data for Capital City:
- IND for India
- AU for Australia
- US for United States of America
After inserting the test data we have to run the payload against the SOAP the you will get the response
Then only you have to construct VUser Script
We can execute Web Services in 4 ways
- Web services using Web http/html protocol
Open the Vugen >> Click on New Script >>
Construct the Web Custom request for that API call
Take functional reference from the VUgen help menu
web_custom_request(“post_query.exe”, “Method=POST”,
“URL=http://lazarus/cgi–bin/post_query.exe”,
“Body=–––––––––––––––––––––––––––––292742461228954\r\nContent–Disp”
“osition: form–data; name=\”entry\”\r\n\r\nText\r\n––––––––––”
“–––––––––––––––––––292742461228954\r\nContent–Disposition: f”
“–––––––––––292742461228954––\r\n”,
“TargetFrame=”,
LAST );
How to build web_custom_request :
- Parameter name: Naming convention
- Method: In the place of method you have to provide GET/POST methods
For the GET purpose you can use either Web_url of Web_submit_data
For the POST purpose you have to use Web_custom_request or Web_submit_data
Differences between web_url and web_submit_data
Web_url | Web_submit_data |
1. It is always a get method | 1. It is used for either get or post purpose |
2. Arguments:Pname, url, resource, target browser, Mode | 2. Arguments: Pname, Action, method, refer, Target frame |
3. Here no body | 3. Here Body argument is exists
In this body you have to post the body data. |
Once you will execute the script fails
Reasons:
- Headers might be missing.
2. Cookies might be missing.
3.Extended log is disabled.
You have to enable
Parameter substitution, Advanced trace, Data returned by server
- Parameter Substitution: If you enable the parameter substitution in the RTS the only it substitutes the parameter value.
- Data Returned by the Server: If you request some thing from uvgen script it will goes to the server and returns the result in the response.
iii. Advanced trace: It includes the “Environment information along with TimeStamp”
Response after enabling the extended log:
Verification & Validation :
- Whenever you want to verify the response with the expected response you have to insert verification point for that
Case 01: If you are using Web http/html protocol instead of Web Services protocol
You have to insert web_reg_find function for the verification purpose.
Syntax: Syntax and how to use the function
Arguments in the web_reg_find
Text: Here you have to take “Unique text” for verification purpose
Search: Optimization technique you will search from the body or Header
Body/Header.
SaveCount: Here you will find how many times the text is presented.
Associated SS shown below
// Run the Web Tours sample
web_url(“MercuryWebTours”,
“URL=http://localhost/MercuryWebTours/”,
“Resource=0”,
“RecContentType=text/html”,
“Referer=”,
“Snapshot=t1.inf”,
“Mode=HTML”,
LAST );
// Set up check for successful login by looking for “Welcome”
web_reg_find(“Text=Welcome”,
LAST );
// Now log in
web_submit_form(“login.pl”,
“Snapshot=t2.inf”,
ITEMDATA,
“Name=username”, “Value=jojo”, ENDITEM,
“Name=password”, “Value=bean”, ENDITEM,
“Name=login.x”, “Value=35”, ENDITEM,
“Name=login.y”, “Value=14”, ENDITEM,
LAST );
*web_reg_find searches for the text string “Canberra”.
If the string is not found, it fails and stops the script execution.
web_reg_find(“Text=Canberra“, LAST);
If you insert SaveCount option it will let you how many times it presents in the response.
Web _find | Web_reg_find |
1. Not a registered function | 1. It is registered function |
2. we will use after the request | 2. We will use before the request |
3. It is deprecated | 3. Currently in the use |
4. There is no SaveCount option | 4. SaveCount option is there |
Parameterization:
Paramerization is same as web http/html protocol.
Web_submit_data and web_submit_form:
- Context less data 2. It is context based data