Tuesday 30 November 2010

QTP Training @ HiTech City

Leave a Comment

With practical orientations, real time scenarios, scripts, demos, presentations, videos and materials.


QTP Automation & VB Script
HP Tools (QTP / LR / QC)


Hitech City :
Phone @ 7799430006



Read More...

QuickTestQTP - QTP Training

Leave a Comment
Corporate Training @ Basic and Advanced levels
QTP Automation & VB Script
HP Tools (QTP / LR / QC) by

G A Reddy @ Hitech City

More details about QTP Training @  http://QuickTestQTP.blogspot.com

Manual and Automation trainings with latest HP Tools
o   Manual Testing         
o   QuickTest Professional
o   Load Runner
o   Quality Center          
With practical orientations, scripts, demos, presentations and videos and materials

Contact @  
Rightway Global Solutions
Hitech City :
Phone @  7799430006
1st Floor - 1-98/11/2, Arunodhaya Colony,
Madhapur, Hyderabad.500081


Read More...

Wednesday 24 November 2010

QTP – Outlook Application

Leave a Comment
QTP – Outlook Application

Aim: To send out a mail soon after the QTP – Automation test ends.
  • Copy this code, use it in a notepad or any text editors
  • Save as oMail.vbs.
  • Before adding this, make sure, you have added sufficient information to SendTo, Subject, Body contents and so.
  • Add this file to your framework / multi test manager scripts as the last script
  • It runs as part of your scripts (at the end) and sends out a mail to the loop of the email ids that are added to SendTo with the Subject, Body contents that are specified.


'#############################################################
'@        QTP – Outlook Application
'#############################################################

Dim SendTo, Subject, Body, Attachment
SendTo=" QuickTestQTP@gmail.com"
Subject="QuickTest QTP Info"
Body=" Here are the Automation Test Results; Thanks, G A Reddy"

Call SendMail(SendTo, Subject, Body, Attachment)

'##############################################################
'@Function   :  SendMail
'@Purpose    :  To send a mail with QTP - Automation Test Status
'@Input Paramters: SendTo, Subject, Body, Attachment
'@Output Paramters: None.
'###############################################################

Function SendMail(SendTo, Subject, Body, Attachment)
Set oOutlook=CreateObject("Outlook.Application")  
‘Outlook object is created
Set oMail=oOutlook.CreateItem(0)
oMail.To=SendTo        ‘ Added SendTo address to oMail Obj
oMail.Subject=Subject        ‘ Added Subject to oMail Obj
oMail.Body=Body        ‘ Added Body Contents to oMail Obj
If (Attachment <> "") Then    
oMail.Attachments.Add(Attachment)
‘ Checks if there are any attachments
End If
oMail.Send      ‘ Sending out mail here
oOutlook.Quit            
‘ comment this if you want your outlook not to be closed
Set oMail = Nothing
Set oOutlook = Nothing
End Function

There is also another method using CDO (Collaboration Data Objects)
Make sure that you have installed the CDONTS in your OS before running this script

Info on CDONTS:
CDONTS stands for 'Collaboration Data Objects for Windows NT Server' and as the name suggest it is for NT, sorry Win9x users you don't have this component. The CDONTS component is installed when you install IIS on NT4 and Windows 2000. Although the component will run on Windows XP, Microsoft have decided to remove the component from IIS 5.1 on Windows XP, so you will have to track down a copy of the cdonts.dll and register it on the IIS web server

To use this component to send e-mail you also need the SMTP Server that ships with IIS 4 or 5 installed on the web server. The SMTP server is usually installed by default with the standard IIS installation.

'#############################################################
'@Function   :  SendMail
'@Purpose    :  To send a mail with QTP - Automation Test Status
'@Input Paramters: SendFrom, SendTo, Subject, Body, Attachment
'@Output Paramters: None.
'##############################################################

Function SendMail(SendFrom, SendTo, Subject, Body)
Set oMail=CreateObject("CDONTS.Newmail")
oMail.From = SendFrom
oMail.To = SendTo
oMail.Subject = Subject
oMail.Body = Body
oMail.Send
Set objMail = Nothing
End Function

If you are unable to install this CDONTS the try with CDO

'###########################################################
'@Function : SendMail1
'@Purpose : To send a mail with QTP - Automation Test Status
'@Input Paramters:  SendFrom, SendTo, Subject, Body, Attachment
'@Output Paramters: None.
'#############################################################

Function SendMail1(SendFrom, SendTo, Subject, Body)
Set ObjMail=CreateObject("CDO.Message")
ObjMail.From = SendFrom
ObjMail.To = SendTo
ObjMail.Subject = Subject
ObjMail.TextBody = Body
ObjMail.Send
set objMail = Nothing
End Function

Read More...

Friday 19 November 2010

Performance Test - Short Notes

1 comment

Performance Testing:


Overview
This paper introduces Performance testing and describes how to perform Performance testing, and tools and techniques relevant information to Performance testing.

Couple of definitions, explanations: what is Performance Testing?
  • In general, Performance testing is the process of testing the application to check if the application behaves well under the specified conditions (User loads, transactions, speed, process, memory, threads, hits, throughputs and so...)
  • The objective of a performance test is to demonstrate that the system meets requirements such as defined number of user loads, transactions, and throughput and response times as part of system/application performance.
  • Performance testing can be done for determining the speed or effectiveness of a computer, network, software program or device.
  • This process can involve quantitative tests done in a lab, such as measuring the response time or the number of MIPS (millions of instructions per second) at which a system functions. Qualitative attributes such as reliability, scalability and interoperability may also be evaluated. Performance testing is often done in conjunction with stress testing.
  • Performance testing can verify that a system meets the specifications claimed by its manufacturer or vendor.

Performance test approach:
Let’s consider a small scenario here.
Let’s say, for example…we are in search of “QTP” company info on the Google.
If, all of us (let’s say 100 members of us) search the word “QTP” at a time in Google, will the Google Server handle this load? (user load)
How many transactions (responses) are generated by the Google?
How many number of bytes (throughput) is generated by the Google at this point?
How many users got the results back and how many did not (transaction summary)
And so on….

Hope, you have understood the scenario.
Let’s say we wanted to performance test the above scenario;
Well, in olden days the performance testing was the most critical and toughest test to be performed
Why it was so?
Let’s look at these reasons.
ü  Manual effort is essentially needed.
ü  It was very risky.
ü  Time consuming
ü  Money consuming
ü  No appropriate results though
ü  Heavy maintenance
ü  And there are so many reasons to talk about as such.

Consider the following diagrams.
(A)  Manual effort for Performance Testing
(B)  Automation effort for Performance testing
(C)  Industry-leading automated scalability and performance testing process, in general



Manual effort for Performance Testing                                                       


                                      

Automation effort for Performance testing




Industry-leading automated scalability and performance testing process, in general



With the help of the automation tools, such as LoadRunner, JMeter, Silk Performer ,  Empirix e-Load/RSW …
So with such tools, we have overcome all of the above obstacles.
And thus Performance test has become so easy, so fast, so accurate and so comfortable for the applications to be performance tested.
There are a set of ways, how we can performance test, like Load Test, Stress Test, Performance Test, Capacity test, and so..
But at this moment, let’s accumulate all of these tests and say “Performance test”’ at over all, for an application in general passion.

Let me explain this Performance test process considering LOADRUNNER tool (for better understanding):
         Step 1: Planning the test. Here, we develop a clearly defined test plan to ensure the test scenarios; we develop load-testing objectives. 
         Step 2: Creating Vusers. Here, we create Vuser scripts (Test scripts) that contain tasks performed on the application, and these tasks are measured as transactions. 
         Step 3: Creating the scenario. A scenario is the combination of Load test scripts, Vusers, Performance conditions, Servers and so…
      A scenario defines the events that occur during each testing session.
For example, a scenario defines and controls the number of users to emulate, the actions to be performed, and the servers/machines on which the virtual users run their emulations
         Step 4: Running the scenario.We emulate load on the server by instructing multiple Vusers to perform tasks simultaneously. Before the testing, we set the scenario configuration and scheduling. We can run the entire scenario, Vuser groups, or individual Vusers. 
         Step 5: Monitoring the scenario.We monitor scenario execution using the LoadRunner online runtime, transaction, system resource, Web resource, Web server resource, Web application server resource, database server resource, network delay, streaming media resource, firewall server resource, ERP server resource, and Java performance monitors. 
         Step 6: Analyzing test results. During scenario execution, LoadRunner records the performance of the application under different loads. We use LoadRunner’s graphs and reports to analyze the application’s
Note: VUsers=Virtual users who act as similar as real users (human beings)

Why Performance Test?
Speed - Does the application respond quickly enough for the intended users?
Scalability – Will the application handle the expected user load and beyond?
Stability – Is the application stable under expected and unexpected user loads?
Performance Parameters: Are the no# transactions, throughputs, process, memory, threads and so..
Confidence – Are you sure that users will have a positive experience on go-live day?


Performance Indicators
• Resource utilization: The percentage of time a resource (CPU, Memory, I/O, Peripheral, Network) is busy
• Throughput: Throughput is the average rate of successful message delivery over a communication channel.
The throughput is usually measured in bits per second (bit/s or bps)
• Response time: The time elapsed between a request and its reply.
It is a measure of how responsive an application or subsystem is to a client request.
• Database access rates: The number of times database is accessed by web application over a given interval of time
• Scalability: The ability of an application to handle additional workload, without adversely affecting performance, by adding resources such as processor, memory, and storage capacity

There is a lot to talk about this PERFORMANCE testing, but as of now, I feel this could be enough to make you understand what’s performance test is and how it is being performed and what are all the types and what are all the different performance parameters that can be tested as part of performance test.
Any suggestions, questions, please you are most welcome. Thank you.
Read More...

QTP - DataBase Testing (Demo1)

Leave a Comment

QT_Flight32 is the DSN created for QTP – Flight Application.
Aim:
To connect to the DSN= QT_Flight32
Establish the connection using ADODB
Check the DSN= QT_Flight32 connection
Execute the query = Select * from Orders
Get the number of columns and column names
Get the number of rows
Add a separate column for each column name in QTP-Flight DB
Write rows data in the corresponding columns of the excel sheet

' Sample DataBase Test Script

dim conn,rs
Set conn=createobject("ADODB.Connection")
Set rs=createobject("ADODB.recordset")
strconnection="dsn=QT_Flight32"
conn.open strconnection

If conn.state=1 Then
            Reporter.ReportEvent micpass, "DB Connection sucesful" , "Passed"
            else
            Reporter.ReportEvent micpass, "DB Connection is not sucesful" , "Failed"
End If

Set rs=conn.execute("Select * from Orders")
' To Parameterize the script
'Set rs=conn.execute(DataTable("SQL",dtGlobalSheet))

Set flds=rs.fields
DataTable.SetCurrentRow (0)
 For k= 0 to  flds.count-1
  rs= flds(k).name
  print rs
      datatable.GetSheet("Action1").Addparameter  rs,""
 Next

' Adding query values into excel
set  rs = conn.Execute("  Select * from Orders")
'Set rs=conn.execute(DataTable("SQL",dtGlobalSheet))
   rs.movefirst
 i=1
   While not  rs.eof
  DataTable.SetCurrentRow (i)
  For j=0 to flds.count-1
   DataTable( flds(j).name,"Action1")= rs.Fields( flds(j).name)
  next
  i=i+1
   rs.movenext
 Wend

Results:






Read More...

QTP - FSO (PART 2)

Leave a Comment
dim oFSO
' creating the file system object
set oFSO = CreateObject ("Scripting.FileSystemObject")

'Option Explicit
' **********************************************************
' Create a new txt file 
' Parameters:
' FilePath - location of the file and its name
' **********************************************************
Function CreateFile (FilePath)
    ' varibale that will hold the new file object
    dim NewFile
    ' create the new text ile
    set NewFile = oFSO.CreateTextFile(FilePath, True)
    set CreateFile = NewFile
 End Function

' **********************************************************
' Check if a specific file exist
' Parameters:
' FilePath - location of the file and its name
' **********************************************************
Function CheckFileExists (FilePath)
    ' check if file exist
    CheckFileExists = oFSO.FileExists(FilePath)
 End Function

' **********************************************************
' Write data to file
' Parameters:
' FileRef - reference to the file
' str - data to be written to the file
' **********************************************************
Function WriteToFile (byref FileRef,str)
   ' write str to the text file
   FileRef.WriteLine(str)
End Function

' **********************************************************
' Read line from file
' Parameters:
' FileRef - reference to the file
' **********************************************************
Function ReadLineFromFile (byref FileRef)
    ' read line from text file
    ReadLineFromFile = FileRef.ReadLine
End Function

' **********************************************************
' Closes an open file.
' Parameters:
' FileRef - reference to the file
' **********************************************************
Function CloseFile (byref FileRef)
    FileRef.close
End Function

'***********************************************************
' Opens a specified file and returns an object that can be used to
' read from, write to, or append to the file.

' Parameters:
' FilePath - location of the file and its name
' mode options are:
' ForReading - 1
' ForWriting - 2
' ForAppending - 8
' **********************************************************
Function OpenFile (FilePath,mode)
    ' open the txt file and retunr the File object
    set OpenFile = oFSO.OpenTextFile(FilePath, mode, True)
End Function

' **********************************************************
' Closes an open file. 
' Parameters:
' FilePathSource - location of the source file and its name
' FilePathDest - location of the destination file and its name
' **********************************************************
Sub FileCopy ( FilePathSource,FilePathDest)
    ' copy source file to destination file
    oFSO.CopyFile FilePathSource, FilePathDest
End Sub

' **********************************************************
' Delete a file.
' Parameters:
' FilePath - location of the file to be deleted
' **********************************************************
Sub FileDelete ( FilePath)
    ' copy source file to destination file
    oFSO.DeleteFile ( FilePath)
End Sub

' **********************************************************
' Compare two text files.
' Parameters:
' FilePath1 - location of the first file to be compared
' FilePath2 - location of the second file to be compared
' FilePathDiff - location of the diffrences file
' ignoreWhiteSpace - controls whether or not to ignore differences in whitespace characters
' true - ignore differences in whitespace
' false - do not ignore difference in whitespace
' Return Value: true if files are identical, false otherwise'
' *************************************************************
Function FileCompare (byref FilePath1, byref FilePath2, byref FilePathDiff, ignoreWhiteSpace)

    dim differentFiles
    differentFiles = false

    dim f1, f2, f_diff
    ' open the files
    set f1 = OpenFile(FilePath1,1)
    set f2 = OpenFile(FilePath2,1)
    set f_diff = OpenFile(FilePathDiff,8)

    dim rowCountF1, rowCountF2
    rowCountF1 = 0
    rowCountF2 = 0

    dim str
    ' count how many lines there are in first file
    While not f1.AtEndOfStream
        str = ReadLineFromFile(f1)
        rowCountF1= rowCountF1 + 1
    Wend

    ' count how many lines there are in second file
    While not f2.AtEndOfStream
        str = ReadLineFromFile(f2)
        rowCountF2= rowCountF2 + 1
    Wend

    ' re-open the files to go back to the first line in the files
    set f1 = OpenFile(FilePath1,1)
    set f2 = OpenFile(FilePath2,1)

    ' compare the number of lines in the two files.
    ' assign biggerFile - the file that contain more lines
    ' assign smallerFile - the file that contain less lines
    dim biggerFile, smallerFile
    set biggerFile = f1
    set smallerFile = f2
    If ( rowCountF1 < rowCountF2) Then
        set smallerFile = f1
        set biggerFile = f2
    End If

    dim lineNum,str1, str2
    lineNum = 1
    str = "Line" & vbTab & "File1" & vbTab & vbTab & "File2"
    WriteToFile f_diff,str
     ' loop on all the lines in the samller file
    While not smallerFile.AtEndOfStream
        ' read line from both files
        str1 = ReadLineFromFile(f1)
        str2 = ReadLineFromFile(f2)

   'check if we need to ignore white spaces, if yes, trim the two lines
        If Not ignoreWhiteSpace Then
           Trim(str1)
           Trim(str2)
        End If
 'if there is a diffrence between the two lines, write them to the diffrences file
        If not (str1 = str2) Then
            differentFiles = true
            str = lineNum & vbTab & str1 & vbTab & vbTab & str2
            WriteToFile f_diff,str
        End If
        lineNum = lineNum + 1
    Wend

    ' loop on the bigger lines, to write its line two the diffrences file
    While not biggerFile.AtEndOfStream
        str1 = ReadLineFromFile(biggerFile)
        str = lineNum & vbTab & "" & vbTab & vbTab & str2
        WriteToFile f_diff,str
        lineNum = lineNum + 1
    Wend

    FileCompare = Not differentFiles
End function


' ************** Example of using these functions ***********
FilePath1 = "D:\temp\FSO\txt1.txt"
FilePath2 = "D:\temp\FSO\txt2.txt"
FilePathDiff = "D:\temp\FSO\txt_diff.txt"

d = FileCompare(FilePath1,FilePath2,FilePathDiff,false)

FilePath = "D:\temp\FSO\txt.txt"

set fold = FolderCreate ( "D:\temp\FSO\new")

set f = OpenFile(FilePath,8)
' = WriteToFile(f,"test line")
d = CloseFile(f)


set f = CreateFile(FilePath)

Fexist= CheckFileExists(FilePath)
d = WriteToFile(f,"first line")
d = WriteToFile(f,"second line")

d = CloseFile(f)
FileCopy "D:\temp\FSO\txt.txt","D:\temp\FSO\txt1.txt"
FileDelete "D:\temp\FSO\txt1.txt"

Read More...

Tuesday 30 November 2010

QTP Training @ HiTech City


With practical orientations, real time scenarios, scripts, demos, presentations, videos and materials.


QTP Automation & VB Script
HP Tools (QTP / LR / QC)


Hitech City :
Phone @ 7799430006



QuickTestQTP - QTP Training

Corporate Training @ Basic and Advanced levels
QTP Automation & VB Script
HP Tools (QTP / LR / QC) by

G A Reddy @ Hitech City

More details about QTP Training @  http://QuickTestQTP.blogspot.com

Manual and Automation trainings with latest HP Tools
o   Manual Testing         
o   QuickTest Professional
o   Load Runner
o   Quality Center          
With practical orientations, scripts, demos, presentations and videos and materials

Contact @  
Rightway Global Solutions
Hitech City :
Phone @  7799430006
1st Floor - 1-98/11/2, Arunodhaya Colony,
Madhapur, Hyderabad.500081


Wednesday 24 November 2010

QTP – Outlook Application

QTP – Outlook Application

Aim: To send out a mail soon after the QTP – Automation test ends.
  • Copy this code, use it in a notepad or any text editors
  • Save as oMail.vbs.
  • Before adding this, make sure, you have added sufficient information to SendTo, Subject, Body contents and so.
  • Add this file to your framework / multi test manager scripts as the last script
  • It runs as part of your scripts (at the end) and sends out a mail to the loop of the email ids that are added to SendTo with the Subject, Body contents that are specified.


'#############################################################
'@        QTP – Outlook Application
'#############################################################

Dim SendTo, Subject, Body, Attachment
SendTo=" QuickTestQTP@gmail.com"
Subject="QuickTest QTP Info"
Body=" Here are the Automation Test Results; Thanks, G A Reddy"

Call SendMail(SendTo, Subject, Body, Attachment)

'##############################################################
'@Function   :  SendMail
'@Purpose    :  To send a mail with QTP - Automation Test Status
'@Input Paramters: SendTo, Subject, Body, Attachment
'@Output Paramters: None.
'###############################################################

Function SendMail(SendTo, Subject, Body, Attachment)
Set oOutlook=CreateObject("Outlook.Application")  
‘Outlook object is created
Set oMail=oOutlook.CreateItem(0)
oMail.To=SendTo        ‘ Added SendTo address to oMail Obj
oMail.Subject=Subject        ‘ Added Subject to oMail Obj
oMail.Body=Body        ‘ Added Body Contents to oMail Obj
If (Attachment <> "") Then    
oMail.Attachments.Add(Attachment)
‘ Checks if there are any attachments
End If
oMail.Send      ‘ Sending out mail here
oOutlook.Quit            
‘ comment this if you want your outlook not to be closed
Set oMail = Nothing
Set oOutlook = Nothing
End Function

There is also another method using CDO (Collaboration Data Objects)
Make sure that you have installed the CDONTS in your OS before running this script

Info on CDONTS:
CDONTS stands for 'Collaboration Data Objects for Windows NT Server' and as the name suggest it is for NT, sorry Win9x users you don't have this component. The CDONTS component is installed when you install IIS on NT4 and Windows 2000. Although the component will run on Windows XP, Microsoft have decided to remove the component from IIS 5.1 on Windows XP, so you will have to track down a copy of the cdonts.dll and register it on the IIS web server

To use this component to send e-mail you also need the SMTP Server that ships with IIS 4 or 5 installed on the web server. The SMTP server is usually installed by default with the standard IIS installation.

'#############################################################
'@Function   :  SendMail
'@Purpose    :  To send a mail with QTP - Automation Test Status
'@Input Paramters: SendFrom, SendTo, Subject, Body, Attachment
'@Output Paramters: None.
'##############################################################

Function SendMail(SendFrom, SendTo, Subject, Body)
Set oMail=CreateObject("CDONTS.Newmail")
oMail.From = SendFrom
oMail.To = SendTo
oMail.Subject = Subject
oMail.Body = Body
oMail.Send
Set objMail = Nothing
End Function

If you are unable to install this CDONTS the try with CDO

'###########################################################
'@Function : SendMail1
'@Purpose : To send a mail with QTP - Automation Test Status
'@Input Paramters:  SendFrom, SendTo, Subject, Body, Attachment
'@Output Paramters: None.
'#############################################################

Function SendMail1(SendFrom, SendTo, Subject, Body)
Set ObjMail=CreateObject("CDO.Message")
ObjMail.From = SendFrom
ObjMail.To = SendTo
ObjMail.Subject = Subject
ObjMail.TextBody = Body
ObjMail.Send
set objMail = Nothing
End Function

Friday 19 November 2010

Performance Test - Short Notes

Performance Testing:


Overview
This paper introduces Performance testing and describes how to perform Performance testing, and tools and techniques relevant information to Performance testing.

Couple of definitions, explanations: what is Performance Testing?
  • In general, Performance testing is the process of testing the application to check if the application behaves well under the specified conditions (User loads, transactions, speed, process, memory, threads, hits, throughputs and so...)
  • The objective of a performance test is to demonstrate that the system meets requirements such as defined number of user loads, transactions, and throughput and response times as part of system/application performance.
  • Performance testing can be done for determining the speed or effectiveness of a computer, network, software program or device.
  • This process can involve quantitative tests done in a lab, such as measuring the response time or the number of MIPS (millions of instructions per second) at which a system functions. Qualitative attributes such as reliability, scalability and interoperability may also be evaluated. Performance testing is often done in conjunction with stress testing.
  • Performance testing can verify that a system meets the specifications claimed by its manufacturer or vendor.

Performance test approach:
Let’s consider a small scenario here.
Let’s say, for example…we are in search of “QTP” company info on the Google.
If, all of us (let’s say 100 members of us) search the word “QTP” at a time in Google, will the Google Server handle this load? (user load)
How many transactions (responses) are generated by the Google?
How many number of bytes (throughput) is generated by the Google at this point?
How many users got the results back and how many did not (transaction summary)
And so on….

Hope, you have understood the scenario.
Let’s say we wanted to performance test the above scenario;
Well, in olden days the performance testing was the most critical and toughest test to be performed
Why it was so?
Let’s look at these reasons.
ü  Manual effort is essentially needed.
ü  It was very risky.
ü  Time consuming
ü  Money consuming
ü  No appropriate results though
ü  Heavy maintenance
ü  And there are so many reasons to talk about as such.

Consider the following diagrams.
(A)  Manual effort for Performance Testing
(B)  Automation effort for Performance testing
(C)  Industry-leading automated scalability and performance testing process, in general



Manual effort for Performance Testing                                                       


                                      

Automation effort for Performance testing




Industry-leading automated scalability and performance testing process, in general



With the help of the automation tools, such as LoadRunner, JMeter, Silk Performer ,  Empirix e-Load/RSW …
So with such tools, we have overcome all of the above obstacles.
And thus Performance test has become so easy, so fast, so accurate and so comfortable for the applications to be performance tested.
There are a set of ways, how we can performance test, like Load Test, Stress Test, Performance Test, Capacity test, and so..
But at this moment, let’s accumulate all of these tests and say “Performance test”’ at over all, for an application in general passion.

Let me explain this Performance test process considering LOADRUNNER tool (for better understanding):
         Step 1: Planning the test. Here, we develop a clearly defined test plan to ensure the test scenarios; we develop load-testing objectives. 
         Step 2: Creating Vusers. Here, we create Vuser scripts (Test scripts) that contain tasks performed on the application, and these tasks are measured as transactions. 
         Step 3: Creating the scenario. A scenario is the combination of Load test scripts, Vusers, Performance conditions, Servers and so…
      A scenario defines the events that occur during each testing session.
For example, a scenario defines and controls the number of users to emulate, the actions to be performed, and the servers/machines on which the virtual users run their emulations
         Step 4: Running the scenario.We emulate load on the server by instructing multiple Vusers to perform tasks simultaneously. Before the testing, we set the scenario configuration and scheduling. We can run the entire scenario, Vuser groups, or individual Vusers. 
         Step 5: Monitoring the scenario.We monitor scenario execution using the LoadRunner online runtime, transaction, system resource, Web resource, Web server resource, Web application server resource, database server resource, network delay, streaming media resource, firewall server resource, ERP server resource, and Java performance monitors. 
         Step 6: Analyzing test results. During scenario execution, LoadRunner records the performance of the application under different loads. We use LoadRunner’s graphs and reports to analyze the application’s
Note: VUsers=Virtual users who act as similar as real users (human beings)

Why Performance Test?
Speed - Does the application respond quickly enough for the intended users?
Scalability – Will the application handle the expected user load and beyond?
Stability – Is the application stable under expected and unexpected user loads?
Performance Parameters: Are the no# transactions, throughputs, process, memory, threads and so..
Confidence – Are you sure that users will have a positive experience on go-live day?


Performance Indicators
• Resource utilization: The percentage of time a resource (CPU, Memory, I/O, Peripheral, Network) is busy
• Throughput: Throughput is the average rate of successful message delivery over a communication channel.
The throughput is usually measured in bits per second (bit/s or bps)
• Response time: The time elapsed between a request and its reply.
It is a measure of how responsive an application or subsystem is to a client request.
• Database access rates: The number of times database is accessed by web application over a given interval of time
• Scalability: The ability of an application to handle additional workload, without adversely affecting performance, by adding resources such as processor, memory, and storage capacity

There is a lot to talk about this PERFORMANCE testing, but as of now, I feel this could be enough to make you understand what’s performance test is and how it is being performed and what are all the types and what are all the different performance parameters that can be tested as part of performance test.
Any suggestions, questions, please you are most welcome. Thank you.

QTP - DataBase Testing (Demo1)


QT_Flight32 is the DSN created for QTP – Flight Application.
Aim:
To connect to the DSN= QT_Flight32
Establish the connection using ADODB
Check the DSN= QT_Flight32 connection
Execute the query = Select * from Orders
Get the number of columns and column names
Get the number of rows
Add a separate column for each column name in QTP-Flight DB
Write rows data in the corresponding columns of the excel sheet

' Sample DataBase Test Script

dim conn,rs
Set conn=createobject("ADODB.Connection")
Set rs=createobject("ADODB.recordset")
strconnection="dsn=QT_Flight32"
conn.open strconnection

If conn.state=1 Then
            Reporter.ReportEvent micpass, "DB Connection sucesful" , "Passed"
            else
            Reporter.ReportEvent micpass, "DB Connection is not sucesful" , "Failed"
End If

Set rs=conn.execute("Select * from Orders")
' To Parameterize the script
'Set rs=conn.execute(DataTable("SQL",dtGlobalSheet))

Set flds=rs.fields
DataTable.SetCurrentRow (0)
 For k= 0 to  flds.count-1
  rs= flds(k).name
  print rs
      datatable.GetSheet("Action1").Addparameter  rs,""
 Next

' Adding query values into excel
set  rs = conn.Execute("  Select * from Orders")
'Set rs=conn.execute(DataTable("SQL",dtGlobalSheet))
   rs.movefirst
 i=1
   While not  rs.eof
  DataTable.SetCurrentRow (i)
  For j=0 to flds.count-1
   DataTable( flds(j).name,"Action1")= rs.Fields( flds(j).name)
  next
  i=i+1
   rs.movenext
 Wend

Results:






QTP - FSO (PART 2)

dim oFSO
' creating the file system object
set oFSO = CreateObject ("Scripting.FileSystemObject")

'Option Explicit
' **********************************************************
' Create a new txt file 
' Parameters:
' FilePath - location of the file and its name
' **********************************************************
Function CreateFile (FilePath)
    ' varibale that will hold the new file object
    dim NewFile
    ' create the new text ile
    set NewFile = oFSO.CreateTextFile(FilePath, True)
    set CreateFile = NewFile
 End Function

' **********************************************************
' Check if a specific file exist
' Parameters:
' FilePath - location of the file and its name
' **********************************************************
Function CheckFileExists (FilePath)
    ' check if file exist
    CheckFileExists = oFSO.FileExists(FilePath)
 End Function

' **********************************************************
' Write data to file
' Parameters:
' FileRef - reference to the file
' str - data to be written to the file
' **********************************************************
Function WriteToFile (byref FileRef,str)
   ' write str to the text file
   FileRef.WriteLine(str)
End Function

' **********************************************************
' Read line from file
' Parameters:
' FileRef - reference to the file
' **********************************************************
Function ReadLineFromFile (byref FileRef)
    ' read line from text file
    ReadLineFromFile = FileRef.ReadLine
End Function

' **********************************************************
' Closes an open file.
' Parameters:
' FileRef - reference to the file
' **********************************************************
Function CloseFile (byref FileRef)
    FileRef.close
End Function

'***********************************************************
' Opens a specified file and returns an object that can be used to
' read from, write to, or append to the file.

' Parameters:
' FilePath - location of the file and its name
' mode options are:
' ForReading - 1
' ForWriting - 2
' ForAppending - 8
' **********************************************************
Function OpenFile (FilePath,mode)
    ' open the txt file and retunr the File object
    set OpenFile = oFSO.OpenTextFile(FilePath, mode, True)
End Function

' **********************************************************
' Closes an open file. 
' Parameters:
' FilePathSource - location of the source file and its name
' FilePathDest - location of the destination file and its name
' **********************************************************
Sub FileCopy ( FilePathSource,FilePathDest)
    ' copy source file to destination file
    oFSO.CopyFile FilePathSource, FilePathDest
End Sub

' **********************************************************
' Delete a file.
' Parameters:
' FilePath - location of the file to be deleted
' **********************************************************
Sub FileDelete ( FilePath)
    ' copy source file to destination file
    oFSO.DeleteFile ( FilePath)
End Sub

' **********************************************************
' Compare two text files.
' Parameters:
' FilePath1 - location of the first file to be compared
' FilePath2 - location of the second file to be compared
' FilePathDiff - location of the diffrences file
' ignoreWhiteSpace - controls whether or not to ignore differences in whitespace characters
' true - ignore differences in whitespace
' false - do not ignore difference in whitespace
' Return Value: true if files are identical, false otherwise'
' *************************************************************
Function FileCompare (byref FilePath1, byref FilePath2, byref FilePathDiff, ignoreWhiteSpace)

    dim differentFiles
    differentFiles = false

    dim f1, f2, f_diff
    ' open the files
    set f1 = OpenFile(FilePath1,1)
    set f2 = OpenFile(FilePath2,1)
    set f_diff = OpenFile(FilePathDiff,8)

    dim rowCountF1, rowCountF2
    rowCountF1 = 0
    rowCountF2 = 0

    dim str
    ' count how many lines there are in first file
    While not f1.AtEndOfStream
        str = ReadLineFromFile(f1)
        rowCountF1= rowCountF1 + 1
    Wend

    ' count how many lines there are in second file
    While not f2.AtEndOfStream
        str = ReadLineFromFile(f2)
        rowCountF2= rowCountF2 + 1
    Wend

    ' re-open the files to go back to the first line in the files
    set f1 = OpenFile(FilePath1,1)
    set f2 = OpenFile(FilePath2,1)

    ' compare the number of lines in the two files.
    ' assign biggerFile - the file that contain more lines
    ' assign smallerFile - the file that contain less lines
    dim biggerFile, smallerFile
    set biggerFile = f1
    set smallerFile = f2
    If ( rowCountF1 < rowCountF2) Then
        set smallerFile = f1
        set biggerFile = f2
    End If

    dim lineNum,str1, str2
    lineNum = 1
    str = "Line" & vbTab & "File1" & vbTab & vbTab & "File2"
    WriteToFile f_diff,str
     ' loop on all the lines in the samller file
    While not smallerFile.AtEndOfStream
        ' read line from both files
        str1 = ReadLineFromFile(f1)
        str2 = ReadLineFromFile(f2)

   'check if we need to ignore white spaces, if yes, trim the two lines
        If Not ignoreWhiteSpace Then
           Trim(str1)
           Trim(str2)
        End If
 'if there is a diffrence between the two lines, write them to the diffrences file
        If not (str1 = str2) Then
            differentFiles = true
            str = lineNum & vbTab & str1 & vbTab & vbTab & str2
            WriteToFile f_diff,str
        End If
        lineNum = lineNum + 1
    Wend

    ' loop on the bigger lines, to write its line two the diffrences file
    While not biggerFile.AtEndOfStream
        str1 = ReadLineFromFile(biggerFile)
        str = lineNum & vbTab & "" & vbTab & vbTab & str2
        WriteToFile f_diff,str
        lineNum = lineNum + 1
    Wend

    FileCompare = Not differentFiles
End function


' ************** Example of using these functions ***********
FilePath1 = "D:\temp\FSO\txt1.txt"
FilePath2 = "D:\temp\FSO\txt2.txt"
FilePathDiff = "D:\temp\FSO\txt_diff.txt"

d = FileCompare(FilePath1,FilePath2,FilePathDiff,false)

FilePath = "D:\temp\FSO\txt.txt"

set fold = FolderCreate ( "D:\temp\FSO\new")

set f = OpenFile(FilePath,8)
' = WriteToFile(f,"test line")
d = CloseFile(f)


set f = CreateFile(FilePath)

Fexist= CheckFileExists(FilePath)
d = WriteToFile(f,"first line")
d = WriteToFile(f,"second line")

d = CloseFile(f)
FileCopy "D:\temp\FSO\txt.txt","D:\temp\FSO\txt1.txt"
FileDelete "D:\temp\FSO\txt1.txt"