QTP Virtual Objects

Most of QTP users are very familiar with Virtual Objects because it solves unrecognized application objects problem. Sometime we work with those applications that have different types of objects but tool does not recognize and support those objects as object. So for this kind of problem every successful tool provides the facility to recognize those objects as Virtual Object.

QTP tool is also providing same and easy steps to define the Virtual Object. Basically we used Virtual object functionality when tool does not support any application object as object.

As we discussing Virtual Object in respect to QTP tool, there some important points which should get the notice by every QTP users.

Point 1: Define the Virtual Object size and position in the web page by using the crosshairs pointer.

Point 2: During a run session make sure that application window should come in same size and same location. May be it effect the coordinates of virtual object.

Point 3: We can not insert any checkpoints for virtual object.

Point 4: We can not use Object Spy for virtual Object.

Point 5: We can use Virtual Object only in recording and running session.

Point 6: Virtual objects store in the computer, not only for current test.

Point 7: We can define the virtual object only for those object in which, we can click or double click.

We can see the all defined virtual objects with the help of Virtual Object Manager window. Basically it list out the all created virtual objects. We can delete or disable the objects with the help of Virtual Object Manager and Options windows. Virtual Object Manager window provide the facility to delete the objects after selecting them and if you want tool should keep the objects but don’t recognize, for that you have to check the option “Disable recognition of virtual objects while recording” in Tool > Options window.

I think these are the basic and important points for those who want to use Virtual Object feature in QTP and if I’m missing something please update with your valuable comments

QTP Shortcut Keys

My first CTO says that if you want to be smart user of the system, use shortcut keys to handle your system. So I thought that why should not post the list of QTP shortcut keys for QTP users

May be in these most of shortcut keys are common for most of guys but here most of guys are still newbie in QTP.

Ctrl + N- Creates a New Test

Ctrl+Shift+N- Creates a New Business Test

Ctrl+Alt+N- Creates a New Application Area

Shift+Alt+N- Creates a New Function Library

Ctrl+O- Opens an Existing Test

Ctrl+Shift+O- Opens an existing business component

Ctrl+Alt+O- Opens an existing Application Area

Shift+F2- Rename the Action name

Ctrl+M- Make the comment on current row

Ctrl+Shift+M- Remove the comment

Ctrl+Space- Completes the word if you are typing any VBScript method or object in Expert View

F12- For Standard Checkpoint

Ctrl+F12- For Standard Output Values

F7- Step Generator

F8- New Step in Keyword View

Shift+F8- New Step after block of statement

F3- Recording

F4- Stop the Recording

F5- Run the Script

Ctrl+F5- Run the selected step in the script

Ctrl+R- Open the object repository

Shift+Alt+F3- Analog Recording

Ctrl+Shift+F3- Low Level Recording

F11- Step Into

F10- Step Over

Shift+11- Step out

Ctrl+F10- Run to Step

Ctrl+T- Adds the selected item in the Watch tab

Ctrl+F7- Check the Syntax error in the script.

Ctrl+Page Up or Page Down- Toggles between the Keyword and Expert View.

You can add more if I’m missing some shortcut keys.

QTP Testing Framework

To start the testing with QTP, there is an important concept to understand i.e. framework. Frameworks basically define the way to handle the different operations in different methods.

As we all known we can create the test in two ways in QTP i.e. by recording and by scripting. We should also know that how we can improve the quality of test by using Framework concept. Basically QTP supports three kind of framework i.e. Linear, Modular, and Keyword Driven Framework.

In all three frameworks, Linear Framework is very easy and catchy by all newbie and beginner of QTP. Basically Linear Framework deals with individual script which is recorded under one Action and running individual. I think we all done this thing in very first when we get the QTP but I’m very sure, not all one know that we created and executed the test under Linear Framework. Anyway this is not big deal. I was also not aware when I get the QTP first time. So this is very simple and easy way to create the test by navigating through the application. But by using this method there are some limitations which we can not cross. Sometime when we test some business processes in one application, we may feel that some operations we repeat in all Linear Framework Script. To handle this situation we go with Modular Framework which solves this kind of problem by dividing the single test in multiple part or module.

In modular framework, tester basically divides the test in different parts which give the facility to use the different part of scripts in any tests. That solves the many problem of repeataion of test and gives the facility to make the script reusable? So in one sentence, Division of Linear Framework script in different parts called Modular Framework.

To understand the keyword driven framework, tester should know the basic of programming because it deals with function. In programming, Function is an important part of programming as they allow you to create chunks of code that performs a specific task. Basically we create the functions in the one test and calling these functions as keyword in other tests therefore we are calling keyword driven framework. This is very important and useful framework to deal and handle many critical tasks in testing through QTP.

To know these frameworks in more details you can choose any QTP testing materials.

Quality Center-9.2

There are five major modules which are used to organize and manage the test project.

  • Releases
  • Requirements
  • Test Plan
  • Test Lab
  • Defects

In Quality Center, these are the phases for any test projects.

Releases

For the Releases module, there are two main terms that is-

  • Release
  • Cycle

Release- Release represents a group of changes in the application which will be present in the same application after some duration.

Cycle- A cycle represents a development and QA cycle based on the project time line.

Note- The Release and Cycles have defined start and end date.

Step to define Release and Cycles

Open the QC – Give username and p/w – Select your domain – Select Project – Now login in the QC – Click on Releases button on the sidebar – In the right hand side, select root Releases folder – Click on New Release Folder icon link – New Release folder pop-up comes – Enter Release Folder name ex. ABC – Click OK – Release folder will be added under root Releases folder – Now add sub-folder under ABC – Select created ABC folder – Click New Release icon link – New Release dialog opens – Enter your release name ex. UI – Click OK – Enter Start date, End date and Description for the release – Now the time to add cycle in release folder – Select release folder UI – Click New Cycle icon link – Enter cycle name ex. XYZ – Click OK – Enter Start date, End date, and Description in right side panel.

Requirements

In Requiremnets module we describe that what needs to be tested in the application. There is one important term that is-

Reuirement Tree.

Reuirement Tree- This is a graphical representations of your requirement specification, displaying requirement hierarchically.

Steps to define Project Requirements

 Click on Requirements button on the side bar – Choose View menu – Select Requirement Tree – Create new requirement folder – Select root Requirements folder – Click New Folder icon link – Enter folder name in Create New Requirement Folder ex. Some_Project in dialog box – Click OK button – Requirement folder will be added in requirement tree – Select created folder Some_Project – Click New Requirement icon link – Select Requirement Type (Functional) and in Requirement Name enter “Fucntional Testing” – Click OKNew Requirement dialog box opens – Enter Priority and select your project – Click Submit button – Click Close button – This folder will be added under Some_Project folder – Now add a child requirement – In the requirement tree make sure Functional Testing requirement folder should be selected – Click New Requirement icon link – Select Requirement Type (Functional) and in Requirement Name enter “members” – Click OKNew Requirement dialog box opens – Enter Priority and select your project – Click Submit button – Click Close button – It will be added child requirement under Functional Testing folder – Now assign the requirement to a Cycle – Select your requirement – Choose Requirements Assign to CycleAssign to Cycle dialog opens – In the release tree, expand the tree and check the checkbox for cycle – Click OK button – Click Yes – Now check the Target Release and Target Cycle in details page.

Converting Requirements

In this functionality, we have to convert all requirements folder tree to Test Plan module. We do this because of similar folder tree in both Requirements and Test Plan modules.

Data Driven Testing using Silk Test.

While using Silk Test I was unable to find any easy steps to do data driven through excel files. I read some documents also but I was not able to find any useful result. May be I was novice and not able to understand but I’m still sure, that documents were not delivering easy steps to do DDT through excel.

Here I’m going to listing some easy and clear steps to do Data Driven Test through excel file in Silk Test. I assume that we are familiar with Silk Test windows and flows.

Before describing anything I would like to tell one scenario, where we will do DDT.

We have one search page.
There is one search fields FIND PEOPLE with SEARCH button.
User will come on search page and put the search term in FIND PEOPLE text field.
At last hit the SEARCH button.

So here we will add our DDT.

Step1: Create one excel file with the name of SEARCH.

Step2: Add your search term under Search column.

Note: We assume that you have set-up your project in Silk Test.

Step3: Come in Silk Test window and click Tools menu.

Step4: Select Data Driven Testcase. Remember your test case should be opened in Silk Test.

Step5: It will open Select Testcase dialog box. Select your test case and click OK button.

Step6: It will open Specify Data Driven Script dialog box. Check first radio button “Create a new file/Overwrite an existing file” and hit OK button.

Step7: It will open Select Data Source dialog box. Select Silk DDA Excel option in Select Data Source option field. Now browse your excel file through Browse button and hit OK button after selecting that.

Step8: It will open Specify Data Driven Testcase dialog box. Select first radio button “Add a new Data Driven Testcase” and hit OK button.

Step9: It will open Find/Replace Values dialog. Click Cancel button in Find/Replace Values.

Step10: Come in data driven file which is saved in same test script file name but with the .g.t extension.

Step11: In Data Driven Script file, you can find “Find values of type”, “Replace value with”, Column, and Replace button. If your test data is Text then check Text checkbox. In Table field select Sheet1$ if you enter your test data in sheet 1 in excel file. In Column select column name which you have specified in your excel file. After selecting it you can find Replace button will be enabled.

Step12: Now select values in your DD script, which you want to DD.

Step13: Click Replace button it will replace some code over the values which you have selected.

Step14: Now Save the file and click Run Test Case. It will open Run Test Case dialog. Here select your DD test script and click Run button.

Hope it will be useful for those, who are struggling with DDT in Silk Test.

FOSS.IN, BOF, and SAHI

I am lucky that I attended the FOSS.IN third time. FOSS.IN is India largest Free Open Source Software event that used to bringing all loved one of Open Source. This time we moved one step ahead and discussed about one of our project Ajuby in BOF. BOF means Birds of Feather and in term of dictionary, we can say that “Informal meeting in any topic”. It was the great experience to discuss about our project and our company. It was great to project and take the new flour of sales and marketing with Ajuby. Moses, Sanjay, Avinash, Mini, Abinaya, Shruti, Nidhika, Srividhaya, Amit, Synthia and I, were there to present Ajuby. Ajuby is open source application builder framework which is based on ROR. It is totally free to downloads and customized. It supports most of the databases and runs on webrick and mongrel web servers. After finishing BOF I and Shruti attended Sahi session which is presented by original author of Sahi, Mr. N. Narayan Raman. It was great session to understand about Sahi and learn after Watir. Sahi is open source functional automation tool. It is based on Record and Playback. Basically it is developed in Java and Javascript and used Javascript to manipulate events on the browser. Sahi runs as a proxy server and the browser needs to use the sahi server as its proxy. Sahi is released under the Apache License and supports AJAX, HTTP, and HTTPS. For more details and download the Sahi, you can visit http://sahi.co.in. It is very useful to understand automation testing without paying bucks.

“Sleep” statement in Watir

When you perform testing through any automation testing tool then you also want to see that how your application works with that but it’s not possible with tools. Because mostly all tools are working in milliseconds that’s why we are not able to see real time functions. For this requirement most testing tools uses “wait” or synchronization function. But when I was working on Watir then I faced one problem that, how can I wait ruby script then I discussed my problem with my Ruby Programmer (Rahul). He suggest me to use sleep statement for waiting the script and found it really works. Thanks to Rahul!

So you can also use sleep statement for waiting the script in Watir.

Syntax :-

# Sleep for 6 seconds

sleep 6 (Always use small latter for defining the Variable in Watir script)

How to write test script in Watir

With the Watir testing tool one thing is very necessary that you must have some programming knowledge because Watir is not based on recording and playback concept. In Watir every script is written by tester before running it. If you want to test your web application by Watir then do one thing, open that page which you want to test and open the view source of page. Do you have knowledge about HTML? Because HTML knowledge is very necessary with Watir. If your web contains buttons, text fields, links, drop-down menus then you can write the script for these objects like this-

For Button you can write script like this but take that variable where you have opened IE browser.

variable_name.button(:name, "Button name").click

"Button name" this value should use according to source code.

variable_name (variable name)

button (Class name)

name (name of button)

Button name (name of button which is used in coding).

this syntax will click your button which is present on web page.

For text box.

variable_name.text_field(:name, "text box name").set ("Asit")

.set (this syntax will put your desired word in text box)

For hyper links.

variable_name.link(:text, "link name").click

.click (this syntax will tell to Watir that click link).

For drop down box.

variable_name.select_list(:name, "drop down box name").select ("drop down value")

.select (this syntax will tell to Watir that select drop down values).

So these are some scripts which I have described and I'll come with further discussions about Watir.

Watir

Last two days I spent my time on Watir (Pronounced “Water”) testing tool. It’s open source functional testing tool, means totally free to use and you can download this testing tool from here- Watir But like other testing tools it has some dependencies like it uses Ruby scripting language, IE browser and runs only on Windows. So to use Watir you must install Ruby on your system. It does not support other browsers like Firefox, Mozilla, and others. Watir is totally different from other testing tools like WinRunner, QTP and others because it does not support Recording and Playback concept. Now one question is ommited over here that how we can test our web application? So answer is that we can write test script in Notepad in Ruby scripting language and save with .rb extension and run this file through command prompt.

If you want to install Ruby or Watir testing tool then go to this link-

http://wtr.rubyforge.org/

Today I have written one basic script for Watir, which is given below. If you trying to understand that where we can start then follow this script.

# the watir controller

require ‘watir’

# Open one new IE browser

browser=Watir::IE.new

# Define one variable

test_site=”http://www.openapp.org

# Put the website address in Address Bar browser.goto(test_site)

So this is very small script for opening openapp.org site. If you want to run with Watir then it’s very necessary that you should learn some basics of Ruby.

Here I’m describing how this script works behind the window.

require ‘Watir’ If you want to use Watir testing tool then first type this syntax at the beginning of the script. This syntax allows our test script to use Watir testing tool.

test_site=”http://www.yahoo.com abc is simple variable which is having one URL. In Ruby every variable start with small latter.

browser=Watir::IE.new browser is also simple variable. This syntax tells Watir tool that open one new IE browser.

.new is Method (Please go through Ruby).

browser.goto(test_site) this syntax will tell Watir that put the abc contain URL on the address bar.

.goto is also Method.

So this is description about one small Watir script. I’ll come with further discussions and welcome your questions and suggestions.