Descriptive programming in QTP & How to do descriptive programming

What is descriptive programming in QTP ? How to Do descriptive programming? Those are some common question QTP(Hp QuickTest Pro) users. Descriptive programming is a way for QTP to bypass Object Repository(OR). In this tutorial i will show how to do Descriptive programming. If we want to perform an operation on an object that is not stored in the object repository then we use Descriptive programming.

Here are some advantages of using descriptive programing :
1. Descriptive Programming based Test Scripts run on any Machine easily.
2.Test scripts runs faster than OR based scripts.
3.Easy Maintenance because it doesn’t depend on Object Repository.

There are different ways to create descriptive programing in QTP. Follow rest of the tutorial to find out more about Descriptive Programing:

First way to do Descriptive Programming in QTP:
Example Using Google Search
Step 1: At first we are going to run Internet Explorer. In QTP we use systemutil.Run command to run any program. To do so the syntax will be:

 systemutil.Run "The program we want to run", "the website Address"

Example for opening www.google.com

systemutil.Run "iexplore.exe", "www.google.com"

Step 2: Now we are going to declare variable for this example we are using :
googleSearchText = For the the google search text box.
googleSearchBtn = For Google search button description.
anyPage = For Describing a browser and page.
For Example:

 Dim googleSearchText,googleSearchBtn,anyPage

Step 3: Then We are going to initialize the anyPage variable. We are going to set it to run on any page. Look at the code below:

 Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page")

The purpose of initializing this into variable is to shortening the code.
Step 4: In this step we are going create and describe the objects. Using QTP Object Spy you can get object Properties. It shows the types and properties of an object. Here is what object spy looks like.

QTP Object Spy Descriptive programming in QTP & How to do descriptive programming
It’s possible to get these properties :Syntax for creating and describing object in QTP :

Set Variable_Name = Description.Create
Variable_Name("property").value = "properties from APP"
Variable_Name("property").value = "properties from APP"

Here is an example for describing googleSearchText,googleSearchBtn :

Set googleSearchText = Description.Create
googleSearchText("micclass").value = "WebEdit"
googleSearchText("type").value = "text"
googleSearchText("name").value = "q"

Set googleSearchBtn = Description.Create
googleSearchBtn("micclass").value = "WebButton"
googleSearchBtn("name").value = "Google Search"

Step 5: Now we are going to put all the created objects together to use it. So far we created a Any page object, Google search text box and Google Search button. To use all the object together the syntax is:

anyPage.Type of object(Object Name).command "what we want to search"

Example

anyPage.WebEdit(googleSearchText).Set "Bytetips QTP Tutorial"

This is the Final script we created using descriptive programing. This script will start Internet Explorer and navigate to Google and search for the text provided in the text field. You can copy-paste this script inside qtp to see how this thing works.

systemutil.Run "iexplore.exe", "www.google.com"
Dim googleSearchText,googleSearchBtn,anyPage
Set anyPage = Browser("micclass:=Browser").Page("micclass:=Page") 
Set googleSearchText = Description.Create
googleSearchText("micclass").value = "WebEdit"
googleSearchText("type").value = "text"
googleSearchText("name").value = "q"

Set googleSearchBtn = Description.Create
googleSearchBtn("micclass").value = "WebButton"
googleSearchBtn("name").value = "Google Search"

anyPage.WebEdit(googleSearchText).Set "Bytetips QTP Tutorial"
anyPage.WebButton(googleSearchBtn).Click

Continue Reading →

Import sample database using MySQL workbench – MySQL Tutorial Part 6

This tutorial is about how to import sample database in MySQL Workbench. And how to make new connection on Toad for MySQL after creating database on MySQL. If you are new here then you need to read the tutorials from the links below.

MySQL Import sample database using MySQL workbench   MySQL Tutorial Part 6

MySQL Tutorial for beginners

********************************************************
We started MySQL Beginers Tutorial

MySQL Beginners Tutorial Introduction Part 1
MySQL Command Types MySql Tutorial for Beginners Part 2
Some Tools and Utilities for MySQL Tutorial for Beginners Part 3
MySql Tutorial for Beginners Part 4 – CREATE Statement
MySQL Naming Guidelines -MySQL Tutorial Part 5

*********************************************************

To create / Import sample database, You will need to download Sample Employee Database For MySQL.
Continue Reading →

How to Remove Mac os VMware Fusion created Open With Context Menu

Today i asked myself How to Remove Mac OS VMware Fusion created “Open With” Context Menu? After rebuilding my “Open With” context menu in mac, Vmware fusion was adding Open with context item in my office PC. I followed two different instruction to completely remove vmware created context menu.
Note: This steps solved my problem. It should not damage your system. But If you follow the steps i am not responsible for any damage.
First Step:
The first tips i got from this link:

http://coreygilmore.com/blog/2010/05/13/remove-vmware-fusion-and-parallels-open-with-context-menus/

Before rebuilding your open with context menu in mac you have to follow the steps below:

1. Launch Vmware Fusion then go to Virtual Machine Library.
2. Then right-click on one of the virtual machine. Then Click on settings. You will find the settings for that Vmware Machine.

Clean Open with menu Vmware Fusion How to Remove  Mac os VMware Fusion created Open With Context Menu

3. Now Click on Default Application you will see vmware fusion default application option window like the picture below.

Clean Open with menu Vmware Fusion 2 How to Remove  Mac os VMware Fusion created Open With Context Menu

Remove check mark from Open your Mac files and web links using Windows applications. Then Close the window.

4. Again right click on the vmware machine and click On Show in Finder and right click on the vm image then click on show package contents and go to Application Folder.
vm App delete How to Remove  Mac os VMware Fusion created Open With Context Menu

Back up in a zip file and And delete All the content inside the Application folder.
5. Repeat this steps for all the Vmware machine you have.
6. Now restart and shutdown all the Virtual Machine.

Second Step :

This tips i got from the link below:

http://itpixie.com/2011/05/fix-duplicate-old-items-open-with-list/

Follow the steps below  :

1. Open the Terminal App from Launchpad > other > Terminal

2. Now copy  and paste the code below:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local\
-domain system -domain user

And Hit Enter. Then Wait for the terminal app while rebuilding the open with context menus.
3. Now restart your MAC OS X powered Machine.