Showing posts with label Checkpoint. Show all posts
Showing posts with label Checkpoint. Show all posts

Sunday, June 15, 2008

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

  1. Open a blank test.
  2. Make sure that Flight application is open.
    (Now only QTP with blank test and Flight application should be open).
  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 ok.
  4. Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12).The mouse pointer will become hand and QTP will be minimized.
  5. Click on the "Flights..." button which is on the Right Hand Side of the "Fly To" combo box in the Flight application.
  6. It will open "Object Selection - Checkpoint Properties" window (with WinButton:FLIGHT highlighted). Click ok.
  7. It will open checkpoint properties window. (only one property will be checked in it i.e. 'enabled' with a value of False.)
  8. Click ok. Click on Stop in order to stop the Recording.
  9. 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.

  1. Open a blank test.
  2. Make sure thathttp://www.google.co.in/ is open.(Now only QTP with blank test and www.google.co.in should be open.)
  3. 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.
  4. Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12).
  5. The mouse pointer will become hand and QTP will be minimized.
  6. Click anywhere on the white space on the Google.co.in page.
  7. 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.
  8. Click ok.
  9. A 'Page Checkpoint Properties' window opens up. Let all the options be default. Click ok.
  10. 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"


If you run this test on www.google.com it may fail.

QTP Tutorials 6 - 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. I 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 7 - Image Checkpoint

Lets see 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.

QTP Tutorials 8 - Text Checkpoint

Now we will look at the Text Checkpoint:


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


  1. 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.
  2. 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.
  3. "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.
  4. 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.
  5. 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 9 - 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.editorial.co.in/software/software-testing-life-cycle.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: Software Testing Life Cycle" which has a table icon on its left, where "Software Testing Life Cycle" 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 10 - 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)


It can return either true or false i.e. a boolean value. If it passes, it will return true else it will return false