Sunday, June 15, 2008

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.

0 comments: