Home

June 11, 2016 | Author: sushmasankineni | Category: N/A
Share Embed Donate


Short Description

Download Home...

Description

Places for niit near Bengaluru, Karnataka

NIIT Malleshwaram - 1 Google review www.niit.com - 2 Main Road 4th Block, Opposite Main Entrance of Ram Kr, Vatal Nagraj Road, Rajajinagar, Bengaluru - 080 23388517

NIIT - Place page www.fruitioninfomatics.com - KHB Block Koramangala, Koramangala, Bengaluru - 080 25203726

Niit - 6 Google reviews www.niit.com - KHB Block Koramangala, Koramangala, Bangalore - 080 51216561 More results near Bengaluru, Karnataka » • • • • • •

Home About Books QTP Certification QTP Forums QTP Training

← Part8: QTP and DotNetfactory – UsingXML Weekend Reading – Unicode and Character sets →

Database CheckPoint and QTP – Part1 Database

A series of articles on Database with QTP by your ever helpful moderator Saket. Today almost all the software applications use relational database management systems (RDBMS) to provide persistency to the program. An RDBMS used in application could be the Oracle, SQL, Access, MySQL etc which depends on the requirement of the software program. Testing the functionality of a database is one of the most challenging tasks for software tester. In this part of series we will discuss how we can use database checkpoint in QTP and in the later parts we will understand the key concepts and how to connect to a database using QTP scripting and how we can retrieve data from the database and other important facts. As a good tester you must have basic knowledge of writing query and verify its correctness based on the parameters. For this you will need to first understand the database of the application under test, which includes understanding the referential integrity, security, and data formats. The most important Referential Integrity is basically the schema of the database- a visual diagram of all the tables in your database, which you can get from your development team. This is very important as it provides you all the basic information about your database like how the integrity has been maintained, table information, risks etc. Once you have knowledge on all the intricacies of the database you can begin with your testing. While automating, the very first thing you may face is to connect to the database. Let us first understand the database Checkpoint. Database checkpoint is one of the checkpoints in QTP which is used to test the contents of the database accessed by application under test. It stores the expected data and compares this with the data stored in the database. When you use a database checkpoint in your script, it connects to the database and sends the query to the database to retrieve the current data into the record set. QTP now compares the current data with the expected data stored in the checkpoint and gives you the result as pass or fail. You can create a database checkpoint to confirm that the data being stored in the database does not introduce any error and you can do this by verifying • • •

The data is saved to the correct tables and in proper field The data on different operation in database like insert, delete, update The correctness of data etc.

To understand this lets take a very simple example for Flight Application. Suppose you are updating an order by changing the name, as in the snapshot below. You need to change the customer name to Learnqtp now and update the record. So if you want to verify whether the record is properly updated with the changed name or not, you use the database checkpoint.

To create a database checkpoint in QTP following steps should be followed – Insert statements to update the record in your Script. 1. Go to Insert > Checkpoint > Database Checkpoint. You will see a database query wizard. 2. Select either of the two option there o Create query using Microsoft query – Select this if you want to use Microsoft query. o Specify SQL statement manually – Select this to manually provide the sql query to the database. We will use and go with this option now. Click ‘Next’ once you selected the query definition. 3. Click ‘Create’ button, which will open the data source window, Select ‘Machine Data Source’ and click new. ( To Connect to flight application database there is already a data source as QT_Flight32, we can directly select this press ‘OK’ and jump to step 7)

4. Create New Data Source window opens, Select the type of data source and click Next 5. Select the Driver depending on the database type from the list. For example if your database is SQL – select ‘SQL Server’, for Oracle – select ‘Microsoft ODBC for Oracle’ and follow the onscreen wizard with the details of your database like server name database name etc. Finally Test the connection and press ‘OK’ 6. You will see the data source name just created in the list at Machine Data source. Select and Click ‘OK’ 7. Specify your sql query e.g. for above mentioned example – ‘Select Customer_Name from Orders’. Click Finish 8. It will Open the Database Checkpoint Properties, modify your checkpoint settings, enter the expected data and 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 If DbTable("DbTable").Exist (0) Then Print " Current query : " & DbTable("DbTable").GetTOProperty ("Source") DbTable("DbTable").SetTOProperty "Source", "Select * from Orders" Print " Modified query : " & DbTable("DbTable").GetTOProperty ("Source") End If

Result

Have you downloaded the FREE Optimizing QTP eBook yet? Get It Now! If you want to keep track of further articles on QTP. I recommend you to subscribe via RSS feed. You can also subscribe by Email and have new QTP articles sent directly to your inbox. Related posts: 1. 2. 3. 4. 5.

Database Checkpoint and QTP Part2 – Using Scripts Database Checkpoint and QTP Part 3 – Retrieving Data Video: How to create a table checkpoint? XML HTML and QTP Part1 Part1: QTP and DotNetFactory – Basics

38 comments ↓ #1 Ananya on 03.03.10 at 10:48 Hi Ankur,

How are you? I have one query. I would be grateful to you if you will help me in solving my query:I am using licensed version of QTP 10.0. My application is based on flex and QTP is not able to recognise the flex objects. I did some r&d on it and found that there is flex add in available but I did not find the trial version.I would request you to please share your thoughts on automating flex objects as well so that I could proceed further with my target. Many regards, Ana . #2 Vishal on 03.03.10 at 10:58 Hi Ankur, this is good article…. i have one doubt, can we able to compare sql query result data with data in external .xls file by using database check point. if not, please provide solution how we can do it…. Thanks, #3 varun on 03.03.10 at 14:13 nice post , but the thing which is my time killer is the code snippet for connection to DB . i always copy paste it to make a succesfull connection but i was looking for some simple and well defined code to make a connection. i always used this : set con=Createobject(“ADODB.Connection”) Srvname=”Driver={PostgreSQL ANSI};DATABASE=XYZ;SERVER=000.000.000.000;PORT=5432;UID=postgr es;PWD=;CA=a;A6=;A7=100;A8=4096;B0=255;B1=8190;BI=0;C2=dd_;;CX=1 b503bb;A1=7.4″ con.open Srvname Set Rec = CreateObject(“ADODB.Recordset”) SQL=”update tablename set xyz= ’900′ where id=250316″ Rec.open SQL ,con

all is fine with above code but i always get confused while writing the value for DATABASE ie : Srvname=”Driver={PostgreSQL ANSI};DATABASE=XYZ;SERVER=000.000.000.000;PORT=5432;UID=postgr es;PWD=;CA=a;A6=;A7=100;A8=4096;B0=255;B1=8190;BI=0;C2=dd_;;CX=1 b503bb;A1=7.4″ Can you make life easy #4 Milindsd on 03.04.10 at 11:00 Good coverage of ‘DB CheckPoints’. Nice article. Awaiting for the Part2. #5 Anoop on 03.04.10 at 11:57 Nice article Saket, will definately try to use it in our scripts. Thanks #6 Saket on 03.05.10 at 11:59 Hi Varun, In the next part of this series you will get some good example and ways to connect to DB. all the required params will be explained in the next part. #7 Database Checkpoint and QTP Part2 – Using Scripts | Learn QTP on 03.10.10 at 21:13 [...] the earlier part of this series we have learnt how to use database checkpoint in database testing. If you don’t want to use the database checkpoint in your database testing, you will have to [...] #8 Tarar on 03.12.10 at 22:31 HI Iam using QTP 10 and using DB checkpoints we have to run the scripts on multiple databases we are having trouble with DB checkpoints for Numaric and string values. Because QTP did not allow to put numaric and string checks in one single db checkpoint so we have to put 2 checkpoints on the same table one for string values and one for numaric values . if the numaric value do not have decimal places its fine under the string checkpoinjt but the problem arises when there are decimal places .

here is the sample data lets say we have a table books which have 2 columns DB 1 Book Name , Price ABC 100 ZAV 100.0 DB 2 Book Name , Price ABC 100 ZAV 100.00 if we put a single checkpoint on DB 1 it will fail on the second db untill unless you put the price columns as numaric check . but the trouble is you can not put the numaric and string checks togather in one db checkpoint. in our case we have to put 2 db check points for the tables where we have both types of data in the table. Anybody know the solution so that we do not have to put the 2 checkpoints every time Thanks for you help . #9 Manpreet on 03.31.10 at 13:08 Hi , I have IE8 and want to Run QTP 9.2 on it .But its not working .I know that if i uncheck the activeX controles it will run but there are some additional dialogs that are comming in IE 8 so Can any one tell what else setting i need to chnage in IE 8 so that it becomes Equvalent to IE 6. Thanks in Advance. Manpreet #10 Saket on 03.31.10 at 16:51 Hi Manpreet, QTP 9.2 does not support IE8, you will have to upgrade to QTP 10. #11 Hitesh shah on 04.12.10 at 12:39 Hi Ankur, we can install QTP 9.5 or 10.00 version on Windows 7 OS ? Pl reply me urgent.

#12 Saket on 04.15.10 at 10:27 Hi Hitesh, refer this Post http://www.learnqtp.com/qtp10-supports-windows7-windows-server-2008-r2/ #13 Database Checkpoint and QTP Part 3 – Retrieving Data | Learn QTP on 04.22.10 at 11:43 [...] Part1 we saw the wizard method to use Database checkpoint. In Part2 we learned how to connect to a database using scripts in QTP. In this part we will see [...] #14 Ram on 04.25.10 at 01:34 Saket, Can we reuse the connection information (connection string) between multiple database checkpoint Or every time we add database checkpoint we need to specify the data source? Certainly it’s fact that all checkpoints in QTP are part of their beginner friendly marketing. For database check, automators should use programmers approach… create data access function(s) using ADO and maintain connection string information in Environment file (similar to global.asax in .Net and property file in J2EE). All you need to do is call getRecordSet (or any name you give) function and provide the sql variable and database name as input and get the result set returned back. than check record-set against the value being displayed on the application. It will increase the readability and re-usability of your code. Though checkpoints are useful they are not the solution in all scenarios. happy programming! #15 Saket on 04.27.10 at 14:53 Hi Ram, Thanks for Pointing this, I have tried to explain the same in later parts of this series. Please continue reading Part 2 and 3. #16 sateesh on 06.29.10 at 14:56

hi while creating DB check point, it is asking for connection string.. can anyone suggest me wat is connection string. #17 Saket Kumar on 07.08.10 at 15:33 Hi Sateesh, This has been discussed in Part 2 of this series. http://www.learnqtp.com/qtp-database-part2-how-to-create-connection-strings/ #18 ramxprss on 07.29.10 at 22:39 HI, I need a query to get the enterprise name from the database ….. #19 sudheer on 07.30.10 at 12:20 con.open “Server=192.168.10.35;Port=1;Database=efare_qa_2_1;Uid=efare_qa_2_1;Pwd=yana123;” when i use above con, QTP shows below error “[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified” Can any one help me to connect MYSQL to QTP using vb script. #20 ramxprss on 08.19.10 at 13:28 HI, There is any options for writing descriptive program using checkpoints manually with out recording….If there is any option tell with some examples… Tnks in advance… #21 Amar on 09.13.10 at 15:42 Hi i need code for the following details. how can we drive the data automatically into the application(offline app) from excel send me the code the application written in the VB6.0 and the data base we are using is MS access. NOTE:the database is a password protected database #22 yvslaxman on 09.23.10 at 12:09 Hi Can anybody can told how to connect flight reservation table showing db error “data source name not found and no defalut driver specified”, can anybody fix the

above error. Can I change the sys date for running of above app.How can i connect flight32 database. Regards LAXMAN #23 Saket on 09.27.10 at 11:04 Hi Laxman, Can you elaborate your query mentioning how you are trying to connect to DB, if required paste the statements and put your query at http://www.learnqtp.com/forums/ ? #24 Hassan on 10.21.10 at 20:02 Hi, Do you know if QTP supports sparql query? Thanks, Mohammed #25 Rajaselvan on 11.12.10 at 20:42 Hi Saket It is good ariticle and it is very esay to read and could understand the concept. Well job #26 Radhika on 11.30.10 at 22:59 Hi Saket, Very good article. I am learning QTP and this is my first attempt using Database Checkpoint. Following your guidance, i recorded script using Flight application. 1. Enter name as “XYZ” 2. Stop recording. 3. Insert database checkpoint as mentioned above and changed value to “ABC” 4. Run the test. My test fails. It shows Expected Value : ABC and Actual Value “XYZ”. I dont understand how should it work. Why it is not updating “XYZ” with “ABC”

Please guide. Thanks, Radhika #27 Saket Kumar on 12.10.10 at 17:23 when you update checkpoint with your expected value, it means you are expecting that value when you DB is updated, so expect that value, which you are entering into database.In this case you are expecting value ‘ABC’ and entering XYZ, so actually XYZ is there in the database not ABC and so it fails. does this help? #28 Sunil Kumar on 12.15.10 at 14:20 Hi All, For database connection, you can use below statement: Set Oconn = CreateObject(“Adodb.Connection”) Oconn .Open Strconnet,Path ‘StrConnect is used to specify the database source name na Path is to specify the path of datbase Set resultSet = Oconn.execute( “Select * from tablename”) #29 srinivasulu.t on 01.17.11 at 13:45 Hi Ankur, I have a small doubt in qtp, how to check wheather the query is executed or not.i am using the below scrtipt for execution of the query Set objCon=Createobject(“Adodb.Connection”) Set objRs=CreateObject(“Adodb.RecordSet”) objCon.Open strDSNName strQuery = “SELECT * FROM ” & strUnitTable & ” WHERE BLC ‘NONE’ AND variable > 1 AND variable < 3 ORDER BY UnitNum" 'query the database Set objRs = objCon.Execute (strQuery) after this code script is not go to the while loop While ( Not objRs.EOF) Print "Testing Purpsoe" Wend

#30 Tarun on 04.28.11 at 16:41 I need some help on PDF file automation by QTP…please suggest where can I post my questions? #31 A K Singh on 04.28.11 at 17:41 Great article. #32 Ashish Bhad on 05.07.11 at 13:31 Hi Ankur, I having some query .I am getting job in automation testing .but But it is by using c# scripting language . hows the future of this back ground i need your suggestion plz give me reply. and also i want to make carrier in automation testing . if u can suggestion plz i am waiting for your reply THANK YOU #33 bhanu on 05.21.11 at 15:19 hi ankur…! u made the learner life easy to find the right guide to learn more about qtp…..am truly happy the way you are fixing out the solutions on every query on QTP…… hope fully move forward for next to learn from u ….. thank u ….! #34 Kavitha on 05.30.11 at 17:19 Hello Ankur, How are you? Thank you so much for your help, you are sending a very good information. I am new to QTP , can you tell me with out any knowledge how can we know when to put check points to the which line while we are doing qtp. Is there any book that i can read and able to under stand the logic I don’t know maybe iam confusing to under stand the system can you please help me #35 gangadhar on 06.11.11 at 19:50 hai to all,am attending for the interviews with 3 years of automation(qtp),vbscript.am not able to write the scripts in interviews.please anyone send me important scripts with answers of clear explanation with comments for each step.please send me mail to:[email protected] #36 Mano on 07.18.11 at 14:18 can i get database result xml file in qtp?

#37 sathish kumar on 08.24.11 at 17:13 Hi, I need to parameter a field value with data’s from a table in Database SQL. can any one guide me #38 Arun on 08.31.11 at 17:32 Great article

Leave a Comment Name Mail Website

Notify me of followup comments via e-mail •

Download QTP eBook! Subscribe to this blog

Beginners on QTP o o o o o

Step by step guide to learn QTP for beginners New Features in QTP 11 New Features in QTP 9.5 Difference between QTP8.2 and QTP9.0/9.2 If QTP does not record on any applications

o o

Testing puzzle that puzzled General Motors Best Lateral Thinking Puzzle



Automation Frameworks o o o o

Understanding Framework Whats your Automation Framework? Building an Automation Framework around Selenium Collection of Articles on Test Automation



HP Related Links o o

Download Trial Version of QTP and Related Addins QTP certification details

Automation Object Model o o o

Basics of AOM Run QTP Scripts at Scheduled Time Check already running process

VB Script and QTP o o o

VB Script and QTP - Part 1 VB Script and QTP - Part 2 VB Script and QTP - Part 3

QTP and Excel o o o

QTP and Excel Part1 QTP and Excel Part2 QTP and Excel Part3

• • •

Recent Posts o o o o o o o o o •

Video: Enhance your productivity with automation Details on QTP 11 Certification (HP0-M47) Automated Mobile Testing with QTP! (Free Webinar) QTP blog is 10,000 subscribers old. Here’s an offer for you. Installing QTP’s trial version Update: QTP Forums Details on QTP Certification v10.0 Automating Word Documents Part-3 Automating MS Word Documents – Part 2



Miscellaneous Concepts on QTP o o o o o o o o o o o o o o o o o o o o o o o

Are You Sure You Want To Use QTP? Descriptive Programming Simplified Difference between Identification and Execution of checkpoint File handling using QTP Identify broken links using QTP Integrating ECATT and QTP Optimize your QTP scripts Points to take care with Active X add-in Points to take care with Oracle/Java add-in Points to take care with QTP and TD/QC Points to take care with Siebel add-in Points to take care with Visual Basic add-in QTP and Reporter Objects Recovery Scenarios in QTP Refresher on how QTP Identifies Objects? Regular Expression Regularized Script to count total no of rows when all are not visible Sending SOAP XML message using QTP Some Useful Tips with QTP Understanding enigmatic TO and RO property Use keyboard to send input to your application Using Relative path in QTP Ways to Launch Application



Gadgets powered by Google



Recent questions on QTP Forums o o o

Two dialog box issues OracleFormWindow not appearing .net add inn

o o o o o o

Comparing two excel files how to get scripts WORKING WITH TREE OBJECTS Create Custom Object How to retrieve test result summary from a test result window using dp? Citrix Automation

About | Consulting/Advertising | QTP Jobs | QTP Training | QTP Certification | Privacy Policy | T & C (© 2006- 2011) Ankur Jain. The content is copyrighted to Ankur Jain and should not be reproduced on other websites.

Software Testing | Quality Center | LoadRunner

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF