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