.

Database Checkpoint and QTP Part2 – Using Scripts

In 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 script it to connect to database and test the records. This gives you more flexibility and options to play around the records. Let us see how we can connect to a database using QTP through scripting.

  • ActiveX Data Objects (ADO) is COM objects which can be used to gain access to a database through QTP. While using ADO you will need to understand three objects
  • Command– Command object is like a container for a command which you send to the database to do some actions. Mostly a sql statement is used as a command to the database.
  • Connection – Connection object is the link between QTP and the database. For any operation you will need to open the connection link initially and make sure you have closed the link once you are done. It requires a connection string to initialize the properties needed to connect to a db .
  • RecordSet – RecordSet object is the container for the command results. The container is called as the cursor. A cursor is like a temporary table in the memory which contains all the characteristics of a table like rows, columns, record pointers etc. This is the object on which plays significant role in your test.

To connect to the database, you will need to use CreateObject method to get the object

Set MyConnection = CreateObject(“ADODB.Connection”)

Next you will need to pass the connection string to the connection object. The connection string is created using certain keywords and values in it depending on the database you need to connect. The keyword Provider (identifies the OLE DB provider to be used.) is used in almost all type of connection and other keywords depends on the database you are connecting. [Note From Ankur: You can use the site ConnectionStrings to build strings corresponding to your database.]

A typical connecting string for database connection will be like –
Continue reading →

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.

Weekend Reading – Unicode and Character sets

unicode-qtp

This article is a link to a dated but still relevant article from one of my favorite tech writers – Joel Spolsky. Article is titled The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) where he has this announcement to be made. 

if you are a programmer working in 2003 and you don’t know the basics of characters, character sets, encodings, and Unicode, and I catch you, I’m going to punish you by making you peel onions for 6 months in a submarine. I swear I will.

In his usual tech-humor style he makes the read quite interesting. Check it out!

PS: You may also be interested in Joel’s rendezvous with Bill Gates.

Database CheckPoint and QTP – Part1

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 couldQTP-database-Checkpoints 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.
Continue reading →

Part8: QTP and DotNetfactory – UsingXML

This is Part8 and last in series  of QTP and DotNetFactory series by Saket. Refer Part1, Part2,Part3, Part4, Part5, Part6, Part7

qtp-dotnetfactory-part8

XML stands for Extensible Markup Language. It a markup language very much similar to HTML but not with predefined tags, used for encoding documents electronically. It has become a very popular means to exchange structured data.

There are several methods in QTP to work with XML file like using XMLUtil, and MSXML. In this article you will learn how to interact with XML files using DotNetFactory in QTP.
Continue reading →