Thursday, 18 September 2014

Database checkpoint:

 Database checkpoint enables user to check the Content of the back end Database.

Steps to follow for inserting Database checkpoint:

QTP need not be in Recording mode and we do not need AUT since data is from backend.

Insert --> checkpoint --> Database checkpoint -->choose “specify SQL statement manually” option -->click next --> click create --> select machine data source --> Select DSN (QT_flight32) --> click OK --> enter SQL statement (select * from orders) --> finish --> click OK









It will add a line in the expert view as:
DbTable("DbTable").Check CheckPoint("DbTable")
 
 
When you will run the script QTP will check the database whether the record is updated with the customer name or not and will give you the result as pass or fail. DbTable is the database table object, which has following properties and methods associated with it.
  • Exist Property –checks whether the database table exists
  • GetToProperty method – is the same method used for test objects to get the specified identification property.
  • SetToProperty method – is to set the specified identification property.
There could be three identification properties of a database table object – Source, dbuniqueid and connectionstring. So we can parameterize the database checkpoint using these properties and methods, for example if you want to use the same checkpoint to run for more query use the ‘SetToProperty’ method to set the source of the DBTable. Following example illustrates above methods
  1. If DbTable("DbTable").Exist (0) Then
  2. Print " Current query : " & DbTable("DbTable").GetTOProperty ("Source")
  3. DbTable("DbTable").SetTOProperty "Source", "Select * from Orders"
  4. Print " Modified query : " & DbTable("DbTable").GetTOProperty ("Source")
  5. End If

.Result--------------------------------------------------------------------------------------------------------


No comments:

Post a Comment