Tuesday 26 June 2012

Webservices


Webservices Type:

web_add_header("SOAPAction", "\"urn:CalculatorAction\"");



soap_request("StepName=SOAP Request",
"URL=http://ws1.parasoft.com/glue/calculator",
"SOAPEnvelope="
""
""
""
""
"1"
"10"
""
""
"",
"SOAPAction=add",
"ResponseParam=response",
"Snapshot=t1340533560.inf",
LAST);

lr_message( lr_eval_string("Response XML is \n{response}") );

Tuesday 27 September 2011

CCI Security error while running on load generator

When ever you get CCI security error, this is something to do with Loadrunner security settings.
Solution: Add the following string to the (probably empty) command line of the script’s group in the load test: "-CANCEL_SECURITY_MODE"

Friday 20 August 2010

Web Services performance testing using load runner

Webservices performance testing has a unique way to perform
Key points:
1. Web service header
2. Webservice body

Generally header and the body is provided by web services development.

For Eg:
Webservice name: Xyz
Action()
{
int Ltv, Term;
char *ltv_string;
web_add_header("SOAPAction",lr_eval_string("http://tempuri.org/Webservicename/webservice_function"));

lr_start_transaction ("xyz1" );

web_custom_request("webservice_function",
"URL=http://xyz31/Design_Time_Addresses/ServiceWS/webservice_function",
"Method=Post",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Mode=HTML",
"EncType=text/xml; charset=utf-8",
"Body="

LAST);

lr_end_transaction ( "xyz1", LR_PASS);

lr_think_time(55) ;

return 0;
}

Tuesday 17 August 2010

VB Script to display the results graph

The following function is very useful in the scenario to display the results in terms of graph:

Public Function getresult_graph()
'Set FSO_Obj_summary = CreateObject("Scripting.FileSystemObject")
'FSO_Obj_summary.CreateTextFile path_summary
Set excel_summary_report = CreateObject("Excel.Application")
'Set excel_summary_report = excel_summary_report.WorkBooks.Open("Test_Data.xls")

'Set excel_summary_report_wrkbook = excel_summary_report.WorkBooks.Open(path_summary)
Set excel_summary_report_wrkbook = excel_summary_report.Worksheets.Add()
Set excel_summary_report_wrkbook_wrkSheet = excel_summary_report_wrkbook.Worksheets("Sheet1")
excel_summary_report_wrkbook_wrkSheet.Cells(1,1) = "ModuleSummary"
excel_summary_report_wrkbook_wrkSheet.Cells(1,2) = "Result status"
excel_summary_report_wrkbook_wrkSheet.Cells(2,1) = "Number of Modules Passed"
excel_summary_report_wrkbook_wrkSheet.Cells(3,1) = "Number of Modules Failed"

excel_summary_report_wrkbook_wrkSheet.Cells(2,2) = 10
excel_summary_report_wrkbook_wrkSheet.Cells(3,2) = 5

'excel_summary_report_wrkbook.
Set oRange=excel_summary_report_wrkbook_wrkSheet.UsedRange
oRange.Select
Set oChart=excel_summary_report.charts
oChart.Add()

'Pie chart
Set oMychart=oChart(1)
oMychart.Activate
oMychart.ChartType=5
oMychart.ApplyDataLabels 5
oMychart.PlotArea.Fill.Visible=False
oMychart.PlotArea.Border.LineStyle=-4142
oMychart.SeriesCollection(1).DataLabels.Font.Size=15
oMychart.SeriesCollection(1).DataLabels.Font.ColorIndex=2
oMychart.ChartArea.Fill.Forecolor.SchemeColor=49
oMychart.ChartArea.Fill.Backcolor.SchemeColor=14
oMychart.ChartArea.Fill.TwoColorGradient 1,1
oMychart.ChartTitle.Font.Size=20
oMychart.ChartTitle.Font.ColorIndex=4

' excel_summary_report_wrkbook.Save
excel_summary_report_wrkbook.Close
Set excel_summary_report = Nothing
Set excel_summary_report_wrkbook = Nothing
Set excel_summary_report_wrkbook_wrkSheet = Nothing
Set FSO_Obj_summary = Nothing

End Function

Wednesday 11 August 2010

Email notification using CDO

The email notification in automation is used to send emails to the users after the tests are completed.
Using CDO :
This is the simple way to send an email notification
' Set the company specific information
' Company Internet Domain Name
ODomain = "xyz.co.uk"

' Set the SMTP server IP
oMyIP = "xxx.yyy.zzz.www"

' Where do you want the message to be delivered
oTo = Email_Address '"Toemail@your.com"

' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing", _
cdoSendUsingPort = 2, _
cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort

' Set the SMTP server address here.
.Item(cdoSMTPServer) = oMyIP
.Update
End With

' Set the message properties.
With iMsg
Set .Configuration = iConf
.To = oTo
.Bcc = "you@your.com"
.Cc = cc@your.com
.From = from@xyz.com
.Subject = ScenarioName & "scenario Execution Status
.HTMLBody = "body of the email"
End With
iMsg.AddAttachment file_path_attachment
'Send the message.
iMsg.Send






Thursday 29 July 2010

Web services automation

I Have been working on software test automation using HP-QTP for some time now, so thought
to share my experience.

Topic: Web services automation
Web services are typically application programming interfaces (API) or web APIs that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services.
Web service is one type of service that can be part of an SOA infrastructure, a web service is defined by a set of technologies that provide platform-independent protocols and standards used for exchanging data between applications.

In a very simple understanding, web services means functions that can be used by anybody from anywhere, so to make this possible these functions are placed on a web server, that is why such functions are called as web services.

There will be functions like tax calculation, credit checks which is used by different vendors, so these functions are updated in web server and that's why these are called web services. So these web services need to be verified with multiple inputs that is why we are using QTP to test our web services.

So for automating this kind of services needs a different approach of automation rather than normal GUI.
Following are the steps in automating the web services:
I am trying to give steps which you may not be able to use directly (because of some confidential info in it), the same steps can be used as a reference
Step 1. For testing web services the most important thing that we must know is WSDL(Web Services Description Language) location
Use the WSDL link in webservices wizard as shown

URL: URL for WSDL needs to be assaigned














Step2: Select the functionality

Once WSDL is selected, as a next step it displays all the functions associated with this web service
Select the desired function and place it in the selected options











Step3:Add xml checkpoint
Add the XML checkpoints after each relevent step














Step4: QTP Generates Web services test
This step confirms the test generation for the wb service function




Step5:
This step confirms the addition of xml checkpoints to the test





Step6:QTP generates web services testing function on editor














the generated code looks like:
' tir-port-typeService Web service object steps
Set tircalc = WebService("tir-port-typeService").tircalc(XMLWarehouse("tircalc_request"))
WebService("tir-port-typeService").Check CheckPoint("tircalc")

Step7: Go to Object repository and then to checkpoint points options














Step8: Click on drop down list of checkpoints and navigate till the values, then click on value and change it to get data from datatable and also copy the datatable name to excel.














Step9:Switch to the keyword view











Step10: select the function name and then click on regular expression button
Select parameter on the value configuration option -> XML structure -> existing (if you have dates in the xml format)










Select the parameter to parameterise the data, and click on edit xml structure













Parameter values looks like below:














Copy the name of values to xls to enter the data:

Import the .xls file and run for multiple iterations: Code

DataTable.Import("C:\Documents and Settings\Xyz49\Desktop\WebServices_Data.xls")

WebServices_Data.xls is the data file.

The code in the expert view looks as below:

' tir-port-typeService Web service object steps

Set tircalc = WebService("tir-port-typeService").tircalc(XMLWarehouse("tircalc_request"))

WebService("tir-port-typeService").Check CheckPoint("tircalc")

Run the test: (F5)

Verifying the results:













Click on “View XML checkpoint Results” and Verify the results
As the snap on the side shows which parameter data exactly failed.













Hope this article helps .. If you have any questions or suggestions please let me know..