Monday, December 15, 2008

Learn Software Testing

As a Fresher you can not get a job in IT industries. Please Spend some mints………….
One more IMPARTANT thing that do not go for Back Door Enter. It does not work. Do not kill your eyes by your self.

Its all in the mind. You raise your thoughts, confidence will automatically shape up. And then you end up doing the impossible. Thoughts should be programmed continuously, coz they form the basis of all the emotions, all the actions.

Real success is finding your lifework in the work that you love. Success usually comes to those who are too busy to be looking for it. Henry David Success consists of going from failure to failure without loss of enthusiasm-Winston Churchill

Hi, dear friends this Chakri working as software test engineer in MNC. If you are really serious about your Software Testing Career take my help. For any information do not hesitate to call me or mail me this is my email id: ready4qtp@gmail.com and Number 919000500042.

QTP

Here iteration means repeat the processes, with same values

or different values,when You take the datadriven test with

different values... the test process repeats that much of

time.


or

Iteration is nothing but one or more times Run the testscript
that is called iteration
in qtp we can see the test result is Testresult window

QTP Tutorials 1 - Familiarizing with recording process

We will test with the mercury sample application FLIGHT.

QTP script consists of things like actions, functions etc. In QTP 9 we can place 120 actions in a script, this is a limit.

We will begin with a simple test like the "hello world" program with which we start learning any programming language.

1) First of all click on Record toolbar button ( or Automation menu --> Record or press F3). when we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.

2) Open Flight application (Start -->All programs -->QuickTest Professional --> Sample Applications --> Flight)

3) Type Agent name as "Kumar" (You can enter any, but must be 4 characters or more) and enter password as "mercury".

4) In the flight reservation window that opens up:

a) In the Flight Schedule area, in Date of Flight enter tomorrow's date in mm/dd/yyyy format.( I used tabs to move to next fields)
b)In Fly From enter Denver
c)In Fly To enter London
d) Click on Flights button which is on the right hand side of "Fly To".
Let the default option be selected in the Flights Table.
e) Click ok
f)In the name field enter your name. It will fill rest of the required information by itself.
g) Click on insert order and after the order is inserted
h) Click on File --> exit.

5) Now you have recorded your first script. You can click on the expert view tab to see the script which QTP has recorded for you automatically.

6) Click on run from Automation Menu (or press F5) to open up run dialog box.

7) Go to the "Results Location" tab, and below "write run results to", in "new run results folder" radio button- let it be the default option --C:\Program Files\Mercury Interactive\QuickTest
Professional\Tests\Test1\Res1(you can also change it)

--> click on ok.

This will run you earlier recorded test and show you the results.
But we have to go a long way. This is just the beginning.

Tutorials 2 - Using Data Table

In our next example we will use data table:
There are two types of data tables Design time and Run time:
Design time data table is what you see in the main QTP window and run time data table you can see only in the test results window. Design time data table is always created before running the test while run time data table is generated after execution of the test.

1) Open new test (Ctrl+N)

2) We will click on record toolbar button ( or Automation menu --> record or press F3). when we click on record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.

3) Open Flight application (Start-->All programs-->QuickTest Professional->Sample Applications-->Flight)

4) Type Agent name as "Kumar" (you can enter any, but must be 4 characters or more) and enter password as "mercury".

5) In the flight reservation window that opens up:

6) Click on File-->exit.

7) In the keyword view you will see four headings- Item, Operation, Value, Documentation. Under Value click on Kumar and on the right hand side of Kumar you will see a small icon, just click on that (or press ctrl + F11), The "Value Configuration Options" dialog box opens. In that dialog box click on parameter radio button and select Data Table from there. In Name field enter any variable name (I entered 'username'). Let all other be the default options in this dialog box and click on ok.

--> QTP will add username column in the data table (bottom, left hand side) with 'Kumar' as the first value.
9) Now enter more values in the username column, manually. I entered 'Sachin' and 'Sunil' in 2nd and 3rd column respectively.

10) Save the test. (File-->Save).

11) Now run the test. (follow same steps as we did earlier).

12) If the test ran successfully, in the Results summary window on the left hand side you will see three iterations (because we added 3 variables in the 3 rows of a data table). Expand 1st iteration, it will show action summary for that iteration, expand the action summary, it will show Login, Expand the login. Click on the first option under it "Agent Name: SetText". On the right hand side it will show 1st variable name under details.

13) Similarly you can look for 2nd and 3rd.

QTP Tutorials 3 - Accessing Data Table values through Script

What if we want to write a short script that accesses values from the data Table.

1) Make sure that QTP (with a new blank test) and a blank notepad is open.

2) In the Data Table below write a, b, c in the first column A.

3) Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open windows based application." and click on ok.

4) Just highlight the notepad and write 'a' on it.

5) Click on Stop so as to stop recording.

6) In the expert view your script will look like this:
Window("Notepad").WinEditor("Edit").SetCaretPos 0,0
Window("Notepad").WinEditor("Edit").Type "a"

7) We have to make it look like this:
rc = DataTable.Value("A", dtGlobalSheet)
msgbox rc
Window("Notepad").WinEditor("Edit").SetCaretPos 0,0
Window("Notepad").WinEditor("Edit").Type rc

--> Save the Test.

9) Run the Test again with a blank Notepad open. It will enter all the three values from Data Table into the Notepad

QTP Tutorials 4 - Standard Checkpoint

Checkpoints cannot be added manually, they are inserted using QTP's interface. Results of the checkpoint can be viewed in the Test Results Window.
Checkpoint information is stored in the Local Object Repository. It is in the Resource.mtr file which is in the action folder (if you created checkpoint in action1 then it will be action 1 folder under the folder in which you are saving the test/script, if you created checkpoint in action 2 then it will be action 2 folder and so on) .
In the expert view, on any blank line type Checkpoint and put "(". As soon as you put the starting bracket it will show all the checkpoints you have used in the test.
Now we will start with checkpoints. I will try to show easy to understand example of each and every checkpoint.
Lets start with simple example of standard checkpoint which checks a variety of objects such as buttons, radio buttons, combo boxes etc. Standard checkpoints are supported for all add-in environments
Open a blank test.
Make sure that Flight application is open.
(Now only QTP with blank test and Flight application should be open).
Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open Windows based application." and click ok.
Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12).The mouse pointer will become hand and QTP will be minimized.
Click on the "Flights..." button which is on the Right Hand Side of the "Fly To" combo box in the Flight application.
It will open "Object Selection - Checkpoint Properties" window (with WinButton:FLIGHT highlighted). Click ok.
It will open checkpoint properties window. (only one property will be checked in it i.e. 'enabled' with a value of False.)
Click ok. Click on Stop in order to stop the Recording.
Save the test.
This is a small test in which we have used standard checkpoint and captured the disabled button on the Flight application. Now we can run the test in two ways to see how it fails and passes the results of the checkpoint.
To see a pass test result:
Make sure that this test and Flight application is open.
Click on run.
It will Run the test and show you the result as pass.
To see a Fail test result:

Make sure that this test and Flight application is open.

In the Flight application enter the Date of Flight, Fly From and Fly To fields and nothing else. (The reason for doing this is that it will enable the 'Flight...' button)

Click on run in order to run the test.

It will Run the test and show you the result as Fail. This is because QTP was looking for a disabled 'Flight...' button for which it recorded the information at the record time, but now since the button was enabled at run time, so it failed.
This will help you in understanding the standard checkpoint in QTP more deeply.

QTP Tutorials 5 - Page Checkpoint

Page checkpoint:It is for web applications only.Common things to check with this are load time, broken links etc.
Open a blank test.

Make sure thathttp://www.google.co.in/ is open.(Now only QTP with blank test and www.google.co.in should be open.)

Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Web" tab and choose first option "Record and run test on any open browser." and click ok.

Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12).

The mouse pointer will become hand and QTP will be minimized.

Click anywhere on the white space on the Google.co.in page.

It will Open "Object Selection - Checkpoint Properties" window. Click on 'Page : Google' option which has a page icon on left of it with right corner of the page slightly folded.

Click ok.

A 'Page Checkpoint Properties' window opens up. Let all the options be default. Click ok.

Click on Stop in order to stop the Recording.

In the Expert view it will add just one line:

Browser("Google").Page("Google").Check CheckPoint("Google")

We will explore this line later on.

I ran this test by opening www.google.co.in in offline mode (not on internet). It recorded the following properties:

Property Name Property Value
load time "0"
number of images "2"
number of links "20"

Here it shows the load time as 0 because I did not open Google at the time of running the test, it was already open.

When you run it, in the results window, on left hand side, it will show (when every option is expanded):
Test Checkpoint-page Summary (where Checkpoint-page is the name with which I saved the test

Run-Time Data Table
Checkpoint-page Iteration 1 (Row 1)
Action1 Summary
Google (This will be the browser)
Google (This will be the Page)
Checkpoint "Google"
[/b]

QTP Tutorials 6 - Database Checkpoint

Now we will try out Database checkpoint: using Oracle 9i

First of all you have to connect oracle 9i to QTP 9.(before doing any recording)

For this go to Insert -> Checkpoint -> Database Checkpoint.

A Database Query Wizard opens.

Select ' Specify SQL statement manually' from the Query definition area. Click Next.

Here click on 'Create' button which is on the right of "Connection String:" It will open 'Select Data Source' window. Click on 'Machine Data Source' Tab

Click on New Button.

'Create New Data Source' window opens.

Select 'User Data Source' from Select a type of data source. Click Next.

It will show all the data source drives it could find.

Select Oracle (on my machine it was 'Oracle in OraHome9'). Click Next. Click Finish.

It will open 'Oracle ODBC Driver Configuration' window.

Enter 'Data Source name' ( I entered "oracle")

Enter 'description' (I entered "SQL")

Select 'TNS Service Name' ( I selected 'DB02', my oracle database name) from combo box.

Enter userid (I used SCOTT).

Click 'Test Connection' Button.It will ask for a Password. Enter your password for Oracle.

If successful it will show 'Testing Connection' window with 'Connection Successful' written on it.

This completes our task of Connecting QTP with Oracle.

Now we will record a test.

Open a blank test.

Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Windows Applications" tab and choose first option "Record and run test on any open Windows based application." and click on ok.

Go to Insert (menu)->Checkpoint->Database Checkpoint

A 'Database Query Wizard' opens.

Select ' Specify SQL statement manually' from the Query definition area. Click Next. Click Create.

Go to 'Machine Data Source' Tab

Select Oracle from data source name. Click Ok. It will open 'Oracle ODBC Driver Connect'

Enter password. Click ok

It will come to Database Query Wizard window with 'Connection String' field filled with: "DSN=oracle;UID=SCOTT;PWD=TIGER;DBQ=DB02;DBA
=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;
LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;
MDI=F;CSR=F;FWC=F;PFC=10;TLO=0;"

In the SQL Statement area type "select * from emp;". Click Finish.

It will open 'Database Checkpoint Properties' window with the result of the query. Click Ok.

Click Stop in order to stop the Recording.

In the Expert View, it just adds one line "DbTable("DbTable").Check CheckPoint "DbTable")"
This is the simplest database checkpoint example.

Lets run it.

Click on Run. ( we don't need to open any other window or application to run this as our Oracle is running at the back end as a service - default way in which it was installed- nothing special.)

When it is passed it will show following in the Result window:

Test Checkpoint-database Summary (where Checkpoint-database is the name with which I saved the test)
Run-Time Data Table

Checkpoint-database Iteration 1 (Row 1)
Action1 Summary

DbTable
Checkpoint "DbTable"

( when you click on this, in details it will show checked 112 cells (in your case number of cells may differ).

It means if you go to the oracle and add or delete any row and run this test again it will fail.)

Just try to think how QTP is comparing the expected results with the actual one, with the count of cells.

QTP Tutorials 7 - Bitmap Checkpoint

Now we will look at the bitmap checkpoint which is different from the image checkpoint.

Make sure that QTP and the Flight application are open.

STYLE A

1. Open a blank test.

2. Click on Record. When we click on Record, "Record and Run Settings" window
opens up. Go to "Windows Applications" tab and choose first option "Record and
run test on any open windows based application." and click Ok.
3. Go to Insert (menu)->Checkpoint->Bitmap Checkpoint
4. Click on the "Fly To" combo box.
5. "Object Selection- Bitmap Checkpoint Properties" window opens up. It will have "WinComboBox:Fly To" highlighted. Click ok
6. It will open "Bitmap Checkpoint Properties" window.
7. Change the "Checkpoint timeout" at the bottom of the window to 0 seconds, so that we will have no wait time while running the test.
8. Click ok.
9. Click stop to stop recording the test.

STYLE B

Above, after 3rd point, instead of clicking on the "Fly To" combo box, click somewhere in the empty space above the "Fly From" Combo box but below the line, i.e. in the "Flight Schedule" area.

"Object Selection- Bitmap Checkpoint Properties" window opens up. It will have "WinObject:Flight Schedule" highlighted. Click ok

It will open "Bitmap Checkpoint Properties" winodow. This time it will have "Flight schedule" area instead of just the "Fly To" combo box.

Now click on the "Select Area..." button. Mouse pointer will change so that you can select any area by dragging. Just select "Fly From" combo box by dragging.

Change the "Checkpoint timeout" at the bottom of the window to 0 seconds. so that we will have no wait time while running the test.

Click ok.

Click stop to stop recording the test.

Now you can run the test it will pass. To see how it stores the results, just fail the test. If you have recorded in the style A then just select any value in the "Fly To" combo box and then run the test. In the result window on the left hand side when you click on Checkpoint "Fly To:", it will show you the expected bitmap and actual bitmap on the right hand side. (note: it will show that only in case of Failed result)

QTP Tutorials 8 - Image Checkpoint

We will look at the Image checkpoint.

Open a blank test.

On your system under My Documents, there will be a folder named My Pictures, under this you will will find a folder- Sample Pictures( containing 4 pictures - Blue Hills, Sunset, Winter, Water lilies)

We will run this test with one of the image there- Sunset.

Go to My Documents->My Pictures-> Sample Pictures and right click on image
named 'Sunset' and open it with internet explorer.

Now only a new blank test and internet explorer with this image should be open.

Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Web" tab and choose first option "Record and run test on any open
browser." and click on Ok.

Go to Insert (menu)->Checkpoint->Standard Checkpoint(or press F12).The mouse pointer will become hand and QTP will be minimized.

Click on the image which is opened in the explorer.

It will open 'Object Selection Checkpoint Properties' window with Image: Sunset highlighted. Click Ok.

It will Open 'Image Checkpoint Properties' Window. In this window just uncheck all the property values like href, html tag etc and only check last property which is src.

Rest every thing will be default. Click OK.

Click stop to stop recording the test.

In the expert view it will just add one line
Browser("file:///C:/Documents%20and%20S").Page("file:///C:/Documents%20and%20S").Image("Sunset").Check CheckPoint("Sunset")

If you run it with that image open in internet explorer it will pass. This test is not intelligent enough. It is just checking that the image in the explorer is in the same location in which it was when the test was recorded and its name is Sunset. If you change the name of some other picture in that folder to Sunset and run the test with that it will also pass.

In this way you can test for some or all the properties of the image which it showed in the 'Image Checkpoint Properties' Window.[/b]

QTP Tutorials 9 - Text Checkpoint

Now we will look at the Text Checkpoint:

1. Open a blank test and a web page in offline mode like this below:


2. Click on Record. When we click on Record, "Record and Run Settings" window opens up. Go to "Web" tab and choose first option "Record and run test on any open browser." and click on ok.

3. Go to Insert (menu)->Checkpoint->Text Checkpoint.
The mouse pointer will become hand and QTP will be minimized.
Click on the first paragraph (which starts with-The page you are looking..) of that web page.

4. "Text Checkpoint Properties" window opens up. It will show the text to be checked in "Checkpoint Summary" area in red color and also show in blue color the text which is displayed before and after the selected text.

5. Click on Configure -here you can change your selected text, change before and after text and so on, but for now just click ok. At the bottom of the "Text Checkpoint Properties" window change 'Checkpoint timeout' to 0 seconds. Again Click ok to come out of "Text Checkpoint Properties" window.

6. Click on stop in order to stop recording.

Run the test and when it is passed just go to the results window and on the left hand side just expand every option and click on last option Checkpoint "Cannot find server". On the right hand side it will show you the details. Try to understand those.

QTP Tutorials 10 - Table Checkpoint

In this tutorial we will look at a table Checkpoint just to get familiar with it.

Open a blank test and also open a website "http://www.softwaretestingadvice.com/index.php" in offline mode.

This website has a table at the bottom of the page.

Click on Record. When we click on Record, "Record and Run Settings" window opens
up. Go to "Web" tab and choose first option "Record and run test on any open
browser." and click on ok.

Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12).

The mouse pointer will become hand and QTP will be minimized.

Click somewhere inside the table.

"Object Selection - Checkpoint properties" window opens.


Select "WebTable: softwaretestingadvice" which has a table icon on its left, where "softwaretestingadvice" is the name of the table.

Click ok.

'Table Checkpoint properties' window opens. It will show all the rows and columns of the selected table. This time we will not do any extra setting. Just change the Checkpoint timeout at the bottom of this window to 0 seconds and click ok .

Click stop in order to stop recording.

Run the test and analyze the results in the result window, mainly the checkpoint results to see how QTP verifies the result. We will manipulate test results in later tutorials.

QTP Tutorials 11 - Checkpoint Return Value

We will use the Standard Checkpoint which we did in tutorial 4.

Open that test that contains the standard Checkpoint.
In the expert view of the test you will see only one line i.e.

Window("Flight Reservation").WinButton("FLIGHT").Check CheckPoint("FLIGHT")

Now we will make some changes in this one line so that it can return some value.

NOTE: Checkpoint always returns a value, it depends on us whether we capture it or not.

Lets now capture it.
Declare a variable and catch the return value in that variable:

Dim return
return = Window("Flight Reservation").WinButton("FLIGHT").Check CheckPoint("FLIGHT")
msgbox (return)


One thing more we need to do here is that we have to enclose Checkpoint ("FLIGHT") in brackets. So the final version looks like this:

Dim return
return = Window("Flight Reservation").WinButton("FLIGHT").Check (CheckPoint("FLIGHT"))
msgbox (return)

Now run the test and see the msgbox appearing with the return value.

QTP Tutorials 12 - Reusable Actions

In this tutorial we will see how to use more than one action in a test and how to call one action from another with in the same test.

Open a blank test. By default it will have Action1 in it (make sure you are in
the keyboard view).

Make sure that Action1 is selected/highlighted and click on the Expert View tab.

In the Expert View type:
msgbox ("my action 1")

Again when you go to keyword View and expand Action1 it will show you function call under it.

In that keyword View itself go to Insert (Menu) ->Call to New Action. 'Insert Call to New Action' Dialog box opens with Action2 as a default name of a new action. By default it will be added at the end of the test as this radio button is selected in the location area.

Click ok.

It will add Action2 to your test.

Make sure that Action2 is selected and click on the Expert View tab.

In the Expert View type:
msgbox ("my action 2")

Similarly insert a third Action.

After third action is added, select Action1(keyword view), right click on it and choose 'Action Properties'.

In the Action properties window that opens, check the 'Reusable action' checkbox at the bottom.

Click ok.

Now again highlight Action3 right click on it and choose 'Insert Call to Existing action'.

'Select action' dialog box appears. In this dialog box in the 'action' dropdown box it will have Action1 by default since we made only that action as reusable.
Just click ok.

In the keyword View where you can see all the three actions, make sure against Action3 it shows "Call to Action1 action" under Documentation.

Run the test. Three message boxes appear in succession showing 'my action 1',
'my action 2', and again 'my action 1'.

QTP Tutorials 13 - Importing Database Table

For this tutorial make sure you completed the Database checkpoint tutorial successfully. Because the connection we made in that tutorial with the oracle will be used here.

It is very simple to import data from database into Data Table.

Right-click somewhere inside the data table.

Go to Sheet->Import->From Database...
"Database Query Wizard" opens.

Click on the radio button "Specify SQL statement manually".

(make sure that "Maximum number of rows" checkbox is NOT checked)

Click Next

Click Create button.

"Select Data Source" window opens

Click "Machine Data Source" Tab

Select Oracle from there and click ok.

Enter password for oracle in the "Oracle ODBC Driver Connect window"

After entering password when you click on ok, it open "Database Query Wizard" window with 'Connection string' automatically filled with info like DSN, UID etc.

Enter SQL statement "select * from emp;" in SQL statement Box.

Click Finish and lo the data is there in the data table.

QTP Tutorials 14 - Script to create file

QTP Tutorials 14 - Script to create file

Now lets do some kind of processing with file system e.g. working with text, excel, word etc files from within the QTP.

For this tutorial you need to know VBScript FSO (File System Object).

The main purpose of the FSO is to access the file system of the computer.

File System Object model is:
DRIVE-----
|
FOLDER-----
|
FILE-----
|
TEXTSTREAM

or some people make it like this:

DRIVE-----
|
DRIVES----
|
FOLDER----
|
FOLDERS----
|
FILE----
|
FILES-----
|
TEXTSTREAM


These above objects have methods and properties. With these above objects you can obtain and work with the information about drives, folders, files etc like creating a new file, opening a file, writing into a file and much more.

Here we will see a very simple example how to create a text file from within QTP.
Dim fso, new_file
Set fso = createobject("scripting.filesystemobject") // an instance of filesystemobject is being created here. After an instance (fso) is created then we can use the methods (like createtextfile, CreateFolder etc) with that objects instance.
Set new_file = fso.createtextfile("c:\testfile.txt", True) //createtextfile is a
method to create a file and after creating a file it returns a TextStream object
that can be used to read from or write to the file.
new_file.writeline("hello world!")
new_file.close

Just write the above text in the expert view of a new blank test and run it. A new text file (testfile.txt) will be created with "hello world!" written in it.

Try to change the extention of testfile.txt to testfile.doc and see what happens.

Thursday, November 27, 2008

QTP Interview Questions

  1. What are the Features & Benefits of Quick Test Pro (QTP 8.0)? - Operates stand-alone, or integrated into Mercury Business Process Testing and Mercury Quality Center. Introduces next-generation zero-configuration Keyword Driven testing technology in Quick Test Professional 8.0 allowing for fast test creation, easier maintenance, and more powerful data-driving capability. Identifies objects with Unique Smart Object Recognition, even if they change from build to build, enabling reliable unattended script execution. Collapses test documentation and test creation to a single step with Auto-documentation technology. Enables thorough validation of applications through a full complement of checkpoints.
  2. How to handle the exceptions using recovery scenario manager in QTP? - There are 4 trigger events during which a recovery scenario should be activated. A pop up window appears in an opened application during the test run: A property of an object changes its state or value, A step in the test does not run successfully, An open application fails during the test run, These triggers are considered as exceptions.You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during test run. Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps: 1. Triggered Events 2. Recovery steps 3. Post Recovery Test-Run
  3. What is the use of Text output value in QTP? - Output values enable to view the values that the application talks during run time. When parameterized, the values change for each iteration. Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.
  4. How to use the Object spy in QTP 8.0 version? - There are two ways to Spy the objects in QTP: 1) Thru file toolbar, In the File Toolbar click on the last toolbar button (an icon showing a person with hat). 2) True Object repository Dialog, In Object repository dialog click on the button object spy. In the Object spy Dialog click on the button showing hand symbol. The pointer now changes in to a hand symbol and we have to point out the object to spy the state of the object if at all the object is not visible. or window is minimized then, hold the Ctrl button and activate the required window to and release the Ctrl button.
  5. How Does Run time data (Parameterization) is handled in QTP? - You can then enter test data into the Data Table, an integrated spreadsheet with the full functionality of Excel, to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage. Data can be typed in or imported from databases, spreadsheets, or text files.
  6. What is keyword view and Expert view in QTP? - Quick Test’s Keyword Driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. Advanced testers can view and edit their tests in the Expert View, which reveals the underlying industry-standard VBScript that Quick Test Professional automatically generates. Any changes made in the Expert View are automatically synchronized with the Keyword View.
  7. Explain about the Test Fusion Report of QTP? - Once a tester has run a test, a Test Fusion report displays all aspects of the test run: a high-level results overview, an expandable Tree View of the test specifying exactly where application failures occurred, the test data used, application screen shots for every step that highlight any discrepancies, and detailed explanations of each checkpoint pass and failure. By combining Test Fusion reports with Quick Test Professional, you can share reports across an entire QA and development team.
  8. Which environments does QTP support? - Quick Test Professional supports functional testing of all enterprise environments, including Windows, Web,..NET, Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and Web services.
  9. What is QTP? - Quick Test is a graphical interface record-playback automation tool. It is able to work with any web, java or windows client application. Quick Test enables you to test standard web objects and ActiveX controls. In addition to these environments, Quick Test Professional also enables you to test Java applets and applications and multimedia objects on Applications as well as standard Windows applications, Visual Basic 6 applications and.NET framework applications
  10. Explain QTP Testing process? - Quick Test testing process consists of 6 main phases:
  11. Create your test plan - Prior to automating there should be a detailed description of the test including the exact steps to follow, data to be input, and all items to be verified by the test. The verification information should include both data validations and existence or state verifications of objects in the application.
  12. Recording a session on your application - As you navigate through your application, Quick Test graphically displays each step you perform in the form of a collapsible icon-based test tree. A step is any user action that causes or makes a change in your site, such as clicking a link or image, or entering data in a form.
  13. Enhancing your test - Inserting checkpoints into your test lets you search for a specific value of a page, object or text string, which helps you identify whether or not your application is functioning correctly. NOTE: Checkpoints can be added to a test as you record it or after the fact via the Active Screen. It is much easier and faster to add the checkpoints during the recording process. Broadening the scope of your test by replacing fixed values with parameters lets you check how your application performs the same operations with multiple sets of data. Adding logic and conditional statements to your test enables you to add sophisticated checks to your test.
  14. Debugging your test - If changes were made to the script, you need to debug it to check that it operates smoothly and without interruption.
  15. Running your test on a new version of your application - You run a test to check the behavior of your application. While running, Quick Test connects to your application and performs each step in your test.
  16. Analyzing the test results - You examine the test results to pinpoint defects in your application.
  17. Reporting defects - As you encounter failures in the application when analyzing test results, you will create defect reports in Defect Reporting Tool.
  18. Explain the QTP Tool interface. - It contains the following key elements: Title bar, displaying the name of the currently open test, Menu bar, displaying menus of Quick Test commands, File toolbar, containing buttons to assist you in managing tests, Test toolbar, containing buttons used while creating and maintaining tests, Debug toolbar, containing buttons used while debugging tests. Note: The Debug toolbar is not displayed when you open Quick Test for the first time. You can display the Debug toolbar by choosing View — Toolbars — Debug. Action toolbar, containing buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow. Note: The Action toolbar is not displayed when you open Quick Test for the first time. You can display the Action toolbar by choosing View — Toolbars — Action. If you insert a reusable or external action in a test, the Action toolbar is displayed automatically. Test pane, containing two tabs to view your test-the Tree View and the Expert View ,Test Details pane, containing the Active Screen. Data Table, containing two tabs, Global and Action, to assist you in parameterizing your test. Debug Viewer pane, containing three tabs to assist you in debugging your test-Watch Expressions, Variables, and Command. (The Debug Viewer pane can be opened only when a test run pauses at a breakpoint.) Status bar, displaying the status of the test
  19. How does QTP recognize Objects in AUT? - Quick Test stores the definitions for application objects in a file called the Object Repository. As you record your test, Quick Test will add an entry for each item you interact with. Each Object Repository entry will be identified by a logical name (determined automatically by Quick Test), and will contain a set of properties (type, name, etc) that uniquely identify each object. Each line in the Quick Test script will contain a reference to the object that you interacted with, a call to the appropriate method (set, click, check) and any parameters for that method (such as the value for a call to the set method). The references to objects in the script will all be identified by the logical name, rather than any physical, descriptive properties.
  20. What are the types of Object Repositories in QTP? - Quick Test has two types of object repositories for storing object information: shared object repositories and action object repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test. The object repository per-action mode is the default setting. In this mode, Quick Test automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object’s property values in one action, you may need to make the same change in every action (and any test) containing the object.
  21. Explain the check points in QTP? - A checkpoint verifies that expected information is displayed in an Application while the test is running. You can add eight types of checkpoints to your test for standard web objects using QTP. A page checkpoint checks the characteristics of an Application. A text checkpoint checks that a text string is displayed in the appropriate place on an Application. An object checkpoint (Standard) checks the values of an object on an Application. An image checkpoint checks the values of an image on an Application. A table checkpoint checks information within a table on a Application. An Accessibilityy checkpoint checks the web page for Section 508 compliance. An XML checkpoint checks the contents of individual XML data files or XML documents that are part of your Web application. A database checkpoint checks the contents of databases accessed by your web site
  22. In how many ways we can add check points to an application using QTP? - We can add checkpoints while recording the application or we can add after recording is completed using Active screen (Note : To perform the second one The Active screen must be enabled while recording).
  23. How does QTP identify objects in the application? - QTP identifies the object in the application by Logical Name and Class.
  24. What is Parameterizing Tests? - When you test your application, you may want to check how it performs the same operations with multiple sets of data. For example, suppose you want to check how your application responds to ten separate sets of data. You could record ten separate tests, each with its own set of data. Alternatively, you can create a parameterized test that runs ten times: each time the test runs, it uses a different set of data.
  25. What is test object model in QTP? - The test object model is a large set of object types or classes that Quick Test uses to represent the objects in your application. Each test object class has a list of properties that can uniquely identify objects of that class and a set of relevant methods that Quick Test can record for it. A test object is an object that Quick Test creates in the test or component to represent the actual object in your application. Quick Test stores information about the object that will help it identify and check the object during the run session.
  26. What is Object Spy in QTP? - Using the Object Spy, you can view the properties of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy displays the selected object’s hierarchy tree and its properties and values in the Properties tab of the Object Spy dialog box.
  27. What is the Diff between Image check-point and Bit map Check point? - Image checkpoints enable you to check the properties of a Web image. You can check an area of a Web page or application as a bitmap. While creating a test or component, you specify the area you want to check by selecting an object. You can check an entire object or any area within an object. Quick Test captures the specified object as a bitmap, and inserts a checkpoint in the test or component. You can also choose to save only the selected area of the object with your test or component in order to save disk Space. For example, suppose you have a Web site that can display a map of a city the user specifies. The map has control keys for zooming. You can record the new map that is displayed after one click on the control key that zooms in the map. Using the bitmap checkpoint, you can check that the map zooms in correctly. You can create bitmap checkpoints for all supported testing environments (as long as the appropriate add-ins are loaded). Note: The results of bitmap checkpoints may be affected by factors such as operating system, screen resolution, and color settings.
  28. How many ways we can parameterize data in QTP? - There are four types of parameters: Test, action or component parameters enable you to use values passed from your test or component, or values from other actions in your test. Data Table parameters enable you to create a data-driven test (or action) that runs several times using the data you supply. In each repetition, or iteration, Quick Test uses a different value from the Data Table. Environment variable parameters enable you to use variable values from other sources during the run session. These may be values you supply, or values that Quick Test generates for you based on conditions and options you choose. Random number parameters enable you to insert random numbers as values in your test or component. For example, to check how your application handles small and large ticket orders, you can have Quick Test generate a random number and insert it in a number of tickets edit field.
  29. How do u do batch testing in WR & is it possible to do in QTP, if so explain? - Batch Testing in WR is nothing but running the whole test set by selecting Run Test set from the Execution Grid. The same is possible with QTP also. If our test cases are automated then by selecting Run Test set all the test scripts can be executed. In this process the Scripts get executed one by one by keeping all the remaining scripts in Waiting mode.
  30. If I give some thousand tests to execute in 2 days what do u do? - Adhoc testing is done. It Covers the least basic functionalities to verify that the system is working fine.
  31. What does it mean when a check point is in red color? what do u do? - A red color indicates failure. Here we analyze the cause for failure whether it is a Script Issue or Environment Issue or a Application issue.
  32. What is Object Spy in QTP? - Using the Object Spy, you can view the properties of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy displays the selected object’s hierarchy tree and its properties and values in the Properties tab of the Object Spy dialog box.
  33. What is the file extension of the code file & object repository file in QTP? - Code file extension is.vbs and object repository is.tsr
  34. Explain the concept of object repository & how QTP recognizes objects? - Object Repository: displays a tree of all objects in the current component or in the current action or entire test (depending on the object repository mode you selected). We can view or modify the test object description of any test object in the repository or to add new objects to the repository. Quicktest learns the default property values and determines in which test object class it fits. If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description. If no assistive properties are available, then it adds a special Ordinal identifier such as objects location on the page or in the source code.
  35. What are the properties you would use for identifying a browser & page when using descriptive programming? - Name would be another property apart from title that we can use.
  36. Give me an example where you have used a COM interface in your QTP project? - com interface appears in the scenario of front end and back end. for eg:if you r using oracle as back end and front end as VB or any language then for better compatibility we will go for an interface. of which COM will be one among those interfaces. Create object creates handle to the instance of the specified object so that we program can use the methods on the specified object. It is used for implementing Automation(as defined by Microsoft).
  37. Explain in brief about the QTP Automation Object Model. - Essentially all configuration and run functionality provided via the Quick Test interface is in some way represented in the Quick Test automation object model via objects, methods, and properties. Although a one-on-one comparison cannot always be made, most dialog boxes in Quick Test have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods. You can use the objects, methods, and properties exposed by the Quick Test automation object model, along with standard programming elements such as loops and conditional statements to design your program.

Tuesday, November 25, 2008

refference site

http://www.onestoptesting.com/qtp/

VBScript in QTP

VBScript in QTP


Scripting language for Quick Test Professional (QTP) is VBScript.

VBScript (short for Visual Basic Scripting Edition) is a lively Scripting language interpreted via Microsoft's Windows Script Host.

VBScript has many powerful functions and provides excellent support for variables, data types, and error handling.

Two script engines can interpret VBScript- VBScript.dll, which is invoked by asp.dll is used in web environment and Wscript.exe & Cscript.exe in Windows GUI environment using Windows script Host (WSH, We typically use VBScript within WSH to automate systems administration tasks. WSH is the system module that transforms a VBScript file into a Windows executable file). Wscript.exe is used to display output and receive input in Windows GUI format such as dialog and input boxes. Cscript.exe is used in a command-line environment. When VBScript source code is contained in stand-alone files, they have the file extension .vbs

Actions in QTP

Actions in QTP 9 (QuickTest Professional)


Actions break up the test into logical sections/units such as specific activities that we perform in our application.

When we create a new test, it contains a call to one action. By breaking up the tests into calls to multiple actions, we can design more modular and well organized and professional tests. An action has its own test script, containing all of the steps recorded in that action, and all objects in its local object repository. An action is stored with the test in which you created it.

If you create a test in which you log into the system (email), check inbox, and then log out of the system (email), your test might be structured as shown—one test calling three separate actions:


Test 1
Actions stored with Test 1
Call to action 1--->Action 1(Logging In)
Call to action 2 --->Action 2(Checking Inbox Mails)
Call to action 3--->Action 3(Logging Out)



Actions make it possible to parameterize and iterate over specific elements of a test. They also make it easier to re-record steps in one action when part of your application changes. For every action called in the test, QuickTest creates a corresponding action sheet in the Data Table so that we can enter Data Table parameters that are specific to that action only.

Three types of actions are: Non-reusable action This non reusable action can be called only once and that too in the test with which it is stored.

Reusable action Reusable actions are like functions in any programming language. If there is a process that needs to be included in several tests, we can record, modify, and enhance the steps of the process and save them in a reusable action. Then we can call the action from other tests, rather than recording, modifying, and enhancing the same steps each time. It can be called several times by the test with which it is stored (the local test), as well as by other tests.

Deleting a reusable action that is called by other tests will cause those tests to fail.

External action is a reusable action stored with another test. External actions are read-only in the calling test, but we can choose to use a local, editable copy of the Data Table information for the external action. When a call to an external action is inserted, the action is inserted in read-only format

We can create an additional call to any reusable or external action in the test by pressing CTRL while we drag and drop the action to another location at a parallel (sibling) level within the test.

By default, new actions are non-reusable. Each action created in a test can be marked as reusable or non-reusable.

When we run a test with multiple actions, the test results are divided by actions within each test iteration so that we can see the outcome of each action, and can view the detailed results for each action individually.

If you expect other users to open your tests and all actions in your tests are stored in the same drive, you should use relative paths for your reusable actions so that other users will be able to open your tests even if they have mapped their network drives differently.

Keyword View

QTP (QuickTest Professional) keyword view


In QTP (QuickTest Professional) we first of all record a test, then run a test and then analyze the results, but before running the test we can also enhance it with checkpoints and parameters.

First of all let's talk a little about keyword view in QTP and then we will talk about recording in QTP and then we will move on to other things.

After recording all the operations, QuickTest displays them as steps in the Keyword View, and generates them in a script (in an Expert View).

In the keyword view there are 4 visible columns –

Item- The item on which we want to perform the step and it can be a test object, utility object, function call, or statement. This column shows a hierarchical icon-based tree. The highest level of the tree is actions, and all steps are contained within the relevant branch of the tree.

Operation- The operation (methods or functions) to be performed on the item selected in the Item column, for example, Click or Select.

Value- The argument values for the selected operation, for example, the mouse button to use when clicking the image.

Documentation- It is a Read-only auto-documentation of what the step does in an easy-to-understand sentence, for example, Click the "findFlights" image.

Assignment- The assignment of a value to or from a variable for example, Store in cCols would store the return value of the current step in a variable called cCols so you can use the value later in the test. This column is not visible by default.

Comment- Any textual information you want to add regarding the step. This column is also not visible by default.

Parameterizing Tests

Parameterizing Tests in QTP (QuickTest Professional)


By replacing fixed values with parameters QuickTest enables you to enlarge the scope of a basic test. It is known as parameterization, greatly increases the power and flexibility of a test. A parameter is a variable that is assigned a value from an external data source or generator. Values in steps and checkpoints and also the values of action parameters can be parameterize.

Parameters let us check how the application performs the same operations with multiple sets of data.

There are four types of parameters:

Test/action parameters: Test parameters make possible for us to use values passed from the test. Action parameters enable us to pass values from other actions in your test. To use a value within a specific action, the value must be passed down through the action hierarchy of the test to the required action. We can then use that parameter value to parameterize a step in the test. For example, suppose that we want to parameterize a step in Action3 using a value that is passed into the test from the external application that runs (calls) the test. We can pass the value from the test level to Action1 (atop-level action) to Action3 (a nested action of Action1), and then parameterize the required step using this action input parameter value (that was passed through from the external application). Alternatively, we can pass an output action parameter value from an action step to a later sibling action at the same hierarchical level. For example, suppose that Action2, Action3, and Action4 are sibling actions at the same hierarchical level, and that these are all nested actions of Action1. We can parameterize a call to Action4 based on an output value retrieved from Action2 or Action3. We can then use these parameters in the action step.

Data Table parameters allow us to create a data-driven test (or action) that runs several times using the data that we supply. In each repetition, or iteration, QuickTest uses a different value from the Data Table.

Environment variable parameters allow us to use variable values from other sources during the run session. These may be values that we supply, or values that QuickTest generates for us based on conditions and options we choose.

Random number parameters enable us to insert random numbers as values in your test.

Values in steps and checkpoints can be parameterized while recording or editing the test.

The values of object properties can be parameterized for a selected step.

The values of the operation (method or function arguments) defined for the step can also be parameterized.

When the value of an object property for a local object is parameterized, we are amending the test object description in the local object repository. Therefore, all occurrences of the specified object within the action are parameterized.

Parameterizing the value of a checkpoint property enables us to check how an application or Web site performs the same operation based on different data.

QTP Recording

QTP (QuickTest Professional) Recording


The default mode of recording is the Normal recording mode. There are other

recording modes also like Analog Recording or Low Level Recording. Normal mode is the default and takes full advantage of the QuickTest test object model, as it recognizes the objects in the application regardless of their location on the screen.

Analog Recording : Exact mouse and keyboard operations are recorded in relation to either the screen or the application window. In this QTP also records and tracks every movement of the mouse for example, recording a signature produced by dragging the mouse. Analog Recording steps are not editable from within QuickTest.

Low Level Recording : At any time, if an environment or on an object not recognized by QuickTest, use Low Level Recording. It records at object level and records all run-time objects as Window or WinObject test objects. QuickTest records all parent level objects as Window test objects and all other objects as WinObject test objects.

Each step recorded in Low Level Recording mode is shown in the Keyword View and Expert View. All the three modes of recording can be used in a single test e.g. we can switch to either Analog Recording or Low Level Recording in the middle of a recording session for specific steps and then return to normal recording mode.

Analog Recording and Low Level Recording require more disk space than normal recording mode.

Use Analog Recording when :

The actual movement of the mouse is what you want to record.

Recording in Analog mode can be relative to the screen or relative to a specific window

In Analog Recording a separate file is saved and stored with the action.

In Analog Recording mode, QuickTest adds to your test a RunAnalog statement that calls the recorded analog file.

Use Low Level Recording when :

Environments or objects not supported by QuickTest.

Exact location of the operation on your application screen is necessary. in normal mode QuickTest performs the step on an object even if it has moved to a new location on the screen.

If the location of the object is important to your test, switch to Low Level Recording.

Checkpoints

A checkpoint enables you to identify whether the Web site or application under test is functioning correctly or not by comparing a current value for a particular property with the expected value for that property.

After we add a checkpoint, QuickTest adds a checkpoint to the current row in the Keyword View and adds a Check CheckPoint statement in the Expert View.

By default, the checkpoint name receives the name of the test object on which the checkpoint is being performed. We can change the name of the checkpoint if needed.

Types of Checkpoints:
  • Standard checkpoint.
  • Image checkpoints.
  • Bitmap Checkpoint.
  • Table checkpoints.
  • Accessibility Checkpoint.
  • Text Checkpoint.
  • Page Checkpoint.
  • Database Checkpoint.
  • XML checkpoints.

Standard checkpoints allow checking the object property values in the Web site or application under test. Standard checkpoints evaluate (compare) the expected values of object properties captured during recording to the object's current values during a run session. For example we can check that a radio button is activated after it is selected. Standard checkpoints are supported for all add-in environments.

Standard checkpoints can be used to perform checks on

Images,

Tables,

Web page properties, and

Other objects within your application or Web site.

Standard checkpoints can be created for all supported testing environments (as long as the appropriate add-in(s) are loaded).

Image checkpoints allow you to check the properties of an image in the application or Web page. For example, you can check that a selected image's source file is correct or not. An image checkpoint can also be created by inserting a standard checkpoint on an image object. Image checkpoints are supported for the Web add-in environment

With Bitmap Checkpoint we can check an area of a Web page or application as a bitmap. While creating a test, we have to specify the area to check by selecting an object. An entire object or any area within an object can be checked. Bitmap checkpoints are supported for all add-in environments

By adding table checkpoints to the test, we can check the content of tables displayed in the application. For example, we can check that a specified value is displayed in a certain cell. Certain environments also support checking the properties of the table object. For example, a check that a table has the expected number of rows and columns. A table checkpoint can also be created by inserting a standard checkpoint on a table object.

Accessibility Checkpoint recognizes areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. For example, check if the images on a Web page include ALT properties, required by the W3C Web Content Accessibility Guidelines.

Accessibility checkpoints are supported for the Web add-in environment

QuickTest can check that a text string is displayed in the appropriate place in an application or on a Web page with Text Checkpoint. Text checkpoints are supported for the Web add-in environment, plus some Web-based add-in environments

Page Checkpoint checks the features of a Web page. For example, you can check how long a Web page takes to load or whether a Web page contains broken links. A page checkpoint can also be created by inserting a standard checkpoint on page object. Page checkpoints are supported for the Web add-in environment

The contents of a database accessed by your application can be checked by Database Checkpoint. Database checkpoints are supported for all add-in environments

By adding XML checkpoints to your test, you can check the contents of individual XML data files or documents that are part of your Web application. The XML Checkpoint option is supported for all add-in environments.

Object Repositories

Object Repositories in QTP 9 (QuickTest Professional)


An object as we know is a graphic user element in an application e.g. a button or a list or an edit box and the special characteristics of an object within the QuickTest are called object properties. QTP stores the recorded object properties in Object Repository.



Object Repositoriesare of two types Local and shared.

If objects are stored in a Local Object Repository then these are available to specific actions but not to all the actions. But if these objects are stored in one or more Shared Object Repositories then multiple actions or tests can use them.

By default QTP makes and uses Local Object Repository. If we create a new blank test and do a recording on it, QTP automatically creates a Local Object Repository for that test or action and stores the information about any object it finds in that corresponding Object Repository.

In QTP 9 we can associate multiple Shared Object Repositories with an action. If multiple Shared Object Repositories are associated with an action then also while recording QTP stores objects in corresponding Local Object Repository on the condition that those objects are not already stored in any corresponding associated Shared Object Repositories. This is the default that every time we create a new action QTP creates a new corresponding Local Object Repository. It is also true that Object Repositories are associated with actions and no matter how many times we learn or record on the same object in our application in different actions the object will be stored as separate test object in each of the Local Object Repository. Local Object Repository is automatically saved with the test when we save it. The extension of the Local Object Repository is .mtr, but it is not accessible as a separate file as in case of the Shared Object Repository.

We can also manipulate some aspects of Local Object Repository using Quick test Object Repository Automation Object Model. For example we can add, remove, rename test objects in Local Object Repository. (QuickTest Object Repository Automation documents the Object Repository automation object model that enables you to manipulate QuickTest object repositories and their contents from outside of QuickTest.)

When we open a test that was created using a version of QTP earlier that version 9 we are asked whether we want to convert it or view it in read only format. In any case if the test previously used per-action Object Repository, the objects in each per action repository are moved to the Local Object Repository of each action in the test.

If the test previously used a shared object repository, the same shared object repository is associated with each of the actions in the test, and the local object repository is empty.

While learning or recording we can specify Shared Object Repository for the selected action. We can specify and associate one or more Shared Object Repositories with each action. We can also create new Shared Object Repository and associate it with our action.

In case of Shared Object Repository, QTP uses existing information and does not add objects to the Object Repository if we record operations on an object that already exists either in Shared or Local Object Repository.

As said earlier QTP does not add objects directly to the associated Shared Object Repository as we record, instead it adds new objects in Local Object Repository (if that object does not already exist in associated Shared Object Repository).

We can surely export Local objects to Shared Object Repository.

There are different ways in which we can move objects from Local Object Repository to Shared Object Repository:

1) Exporting the objects to the Shared Object Repository from the Local Object Repository: In Object Repository window choose the action whose local objects you want to move. Choose File-> Export Local Objects.Select the location in which you want to save the file. Click on save.

2) We can update the Shared Object Repository with the Local Object Repository:

f we create a new test it will be created with Local Object Repository, we can associate any new or old Shared Object Repository with it, and so we can update that Shared Object Repository with Local Object Repository.

In Object Repository Manager open the Shared Object Repository (clear open in read only check box).

The test in this case should not be open. In Object Repository Manager go to Tools –> Update From Local Repository. Select the test who's Local Object Repository you want to use. Click update all. It will move all the objects to the Shared Object Repository.

3) We can also merge objects from two Object Repositories (called as primary and secondary in QTP 9) into a new single Object Repository (target Object Repository in QTP 9). The original source files are not changed. It also enables you to merge objects from Local Object Repository of one or more action(s) into a Shared Object Repository. It is recommended to use as a primary Object Repository the file in which you have invested alot of your effort, like which has more number of objects.

We can compare two Object Repositories using the Object Repository Comparison Tool. The tool enables you to identify similarities, variations or changes between two Object Repositories.

We can also copy objects to Local Object Repository from the Shared Object Repository. We can copy, paste and move objects in Local Object Repository and copy, paste and move objects within Shared Object Repository and between Shared Object Repositories.As said earlier we can also copy objects from shared Object Repository to Local Object Repository to modify them locally.

We cannot remove an association between the action and its Local Object Repository.

Test Object Model

Explain Test object Model, test object and run-time object ?


Test object Model is a set of object types or Classes that QuickTest uses to represents the objects in our application.

A test object class comprises of a list of properties that can individually (uniquely) identify objects of that class and a set of appropriate methods that QuickTest can record for it.

A test object is an object that QuickTest creates in the test to correspond to (represent) the actual object in the application. QuickTest uses the stored information about the object during the run session to identify and check the object.

A run-time object is the real (actual) object in the application or Web site on which methods are performed during the run session.

Properties and methods of objects:

The property set for each test object is created and maintained by QuickTest. The property set for each run-time object is created and maintained by the object architect (creator) (Microsoft for Internet Explorer objects, Netscape for Netscape objects).

Similarly, methods of test objects are methods that QuickTest recognizes and records when they are executed (performed) on an object while we are recording, and that QuickTest executes when the test or component runs. Methods of Run-time object are the methods of the object in the application as defined by the object architect (creator). We can access and execute run-time object methods using the Object property.



Some important points to remember about methods and properties :
  • Each test object method we execute (perform) while recording is recorded as a separate step in the test. When we run the test, QuickTest executes (performs) the recorded test object method on the run-time object.
  • Properties of test object are captured from object while recording. QuickTest uses the values of these properties to identify runtime objects in the application during a run session.
  • Property values of objects in the application may change .To make the test object property values match the property values of the run-time object, we can modify test object properties manually while designing the test or component or using SetTOProperty statements during a run session. We can also use regular expressions to identify property values.
  • We can view or modify the test object property values that are stored with the test or component in the Object Properties or Object Repository dialog box.
  • We can view the syntax of the test object methods as well as the run-time methods of any object on our desktop using the Methods tab of the Object Spy.
  • We can retrieve or modify property values of the TEST OBJECT during the run session by adding GetTOProperty and SetTOProperty statements in the Keyword View or Expert View. We can retrieve property values of the RUNTIME OBJECT during the run session by adding GetROProperty statements.

If the available test object methods or properties for an object are not sufficient or they do not provide the functionality we need, we can access the internal methods and properties of any run-time object using the Object property. We can also use the attribute object property to identify Web objects in the application according to user-defined properties.

QTP Testing Process

QTP (QuickTest Professional) lets you create tests and business components by recording operations as you perform them in your application.

Test - A compilation of steps organized into one or more actions, which we can use to verify that our application performs as expected. A test is composed of actions (3 kinds of actions are there in QTP Non-reusable action, Reusable action and External action).

1) First step is Planning Before starting to build a test, you should plan it and prepare the required infrastructure. For example, determine the functionality you want to test, short tests that check specific functions of the application or complete site.Decide how you want to organize your object repositories.

2)Second step in QTP is Creating Tests or Components

We can create a test or component by

a) Either recording a session on your application or Web site.

As we navigate through the application or site, QuickTest graphically displays each step we perform as a row in the Keyword View. The Documentation column of the Keyword View also displays a description of each step in easy-to-understand sentences. A step is something that causes or makes a change in your site or application, such as clicking a link or image, or submitting a data form.

OR b) Build an object repository and use these objects to add steps manually in the Keyword View or Expert View. We can then modify your test or component with special testing options and/or with programming statements.

3)Third step is Inserting checkpoints into your test or component. A checkpoint is a verification point that compares a recent value for a specified property with the expected value for that property. This enables you to identify whether the Web site or application is functioning correctly.

4)Fourth step is

Broaden the scope of your test or component by replacing fixed values with parameters.

To check how your application performs the same operations with different data you can parameterize your test or component.

When you parameterize your test or component, QuickTest substitutes the fixed values in your test or component with parameters

Each run session that uses a different set of parameterized data is called an iteration.

We can also use output values to extract data from our test or component. An output value is a value retrieved during the run session and entered into the Data Table or saved as a variable or a parameter. We can subsequently use this output value as input data in your test or component.

We can use many functional testing features of QuickTest to improve your test or component and/or add programming statements to achieve more complex testing goals.

5)Fifth step is running the test

After creating test or component, we run it.

Run test or component to check the site or application.

When we run the test or component, QuickTest connects to your Web site or application and performs each operation in a test or component, checking any text strings, objects, or tables you specified. If we parameterized the test with Data Table parameters, QuickTest repeats the test (or specific actions in your test) for each set of data values we defined.

Run the test or component to debug it.

We can control the run session to identify and eliminate defects in the test or component. We can use the

Step Into,

Step Over,

And Step Outcommands to run a test or component step by step. We can also set breakpoints to pause the test or component at pre-determined points. We can view the value of variables in the test or component each time it stops at a breakpoint in the Debug Viewer.

6)Sixth step is analyzing the results

After we run test or component, we can view the results.

? View the results in the Results window.

After running the test or component, we can view the results of the run in the Test Results window. We can view a summary of the results as well as a detailed report.

? Report defects identified during a run session.

If Quality Center is installed, we can report the defects fond out to a database. We can instruct QuickTest to automatically report each failed step in the test or component, or we can report them manually from the Test Results window.

Introduction

Quick Test Professional (QTP) is an automated functional Graphical User Interface (GUI) testing tool that allows the automation of user actions on a web or client based computer application. It is primarily used for functional regression test automation. QTP uses a scripting language built on top of VBScript to specify the test procedure, and to manipulate the objects and controls of the application under test.

What is QTP

Mercury QuickTest Professional™ provides the industry’s best solution for functional test and regression test automation - addressing every major software application and environment. This next-generation automated testing solution deploys the concept of Keyword-driven testing to radically simplify test creation and maintenance. Unique to QuickTest Professional’s Keyword-driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View.QuickTest Professional satisfies the needs of both technical and non-technical users. It enables you to deploy higher-quality applications faster, cheaper, and with less risk. It works hand-in-hand with Mercury Business Process Testing™ to bring non-technical subject matter experts into the quality process in a meaningful way. Plus, it empowers the entire testing team to create sophisticated test suites with minimal training.The deployment of Mercury QuickTest Professional is optimized through the use of Mercury best practices. Mercury best practices cover all aspects of deployment, including product installation and operation, organizational design, process implementation, continual process improvement and measurement of return on investment (ROI). Throughout your implementation Mercury applies these best practices to your specific situation, creating world-class procedures for you that drive long-term success.source