This article will discuss the concepts of Custom Checkpoints, their benefits, when to use them and how they provide us with greater flexibility in script development. Custom CheckPoints offer an easier and highly flexible way of constructing your object verifications, which is a core concept of test automation. The concepts below, when coupled together can help you build extremely robust scripts, with enough information that your user desires.
Before we begin creating CheckPoints as we would for our application(s), let’s do a quick walk-through of the Reporter Object.
Reporter Object
According to QTP help:
Description: The object used for sending information to the test results.
We use the Reporter object along with its ReportEvent method to send the necessary information to the test results:
ReportEvent: Reports an event to the test results.
Below is the syntax of Reporter.ReportEvent method:
Reporter.ReportEvent EventStatus, ReportStepName, Details [, Reporter]
Possible choices for ReportEvent are:
0 or micPass: Causes the status of this step to be passed and sends the specified message to the report.
1 or micFail: Causes the status of this step to be failed and sends the specified message to the report. When this step runs, the test fails.
2 or micDone: Sends a message to the report without affecting the pass/fail status of the test.
3 or micWarning: Sends a warning message to the report, but does not cause the test to stop running, and does not affect the pass/fail status of the test.
Example:
Reporter.ReportEvent micDone, "Step 1", "Step Done."
I wanted to cover the Reporter object real quick because its a core-concept in creating custom checkpoints. We’ll begin creating them now!
Custom CheckPoints and the Exist Method
This is an extremely important concept, and in my opinion, it should serve as the base to all CheckPoints. It checks whether an object exists on the page or not, and before we can start verifying an object’s properties, it’s important that we check if it is even available to us to perform our verifications. Also, if the object is found in the applicantion, the Exist method returns true, else, it returns false. Syntax:
Object.Exist(Timeout)
In the syntax above, Timeout is the amount of time you would like QTP to wait for the object before it returns a boolean output. Let’s see 2 examples of its use.
Case where an object is found
To check if the Text box exists, we can formulate the following code that will wait for a max of 5 seconds before the WebEdit appears on the page:
MsgBox Browser("title:=.*Relevant Codes.*").Page("micclass:=Page")_ .WebEdit("name:=txtExistTest").Exist(5)
Case where an object is not found
Let’s use the same example above, and run the same check for the text box below:
MsgBox Browser("title:=.*Relevant Codes.*").Page("micclass:=Page")_ .WebEdit("name:=txtNotFound").Exist(5) 'False
You may spy on the WebEdit above (just to make sure), and notice that there is actually a textbox with the description we provided. But, still, QuickTest returns a failed status. That is because, for this example, I created 2 such text boxes with the exact same description, so if you just provide the property without an Ordinal Identifier, your code will not work. However still, I feel the above is quite a good example of a scenario that can very well happen in many applications and its a good test of an automation engineer to be cautious from the start.
However, we still haven’t created a CheckPoint yet. A CheckPoint is a conditional method that information the user of an objects’ status during testing. Thus, we must create a conditional method here:
If Browser("title:=.*Relevant.*").WebEdit("name:=txtNotFound").Exist(5) Reporter.ReportEvent micPass, "WebEdit CheckPoint", "WebEdit was found. Step Passed." Else Reporter.ReportEvent micFail, "WebEdit CheckPoint", "WebEdit was not found. Step failed." End If
There you go! You have just created a custom CheckPoint. If you would like to know more about the Reporter object, please use the QTP help, which is an excellent source of information.
Custom CheckPoints and the GetROProperty Method
GetROProperty is short for Get-Runtime-Object-Property. In other words, this method can be used to retrieve the value that the object has, at present. Please note that, in some dynamic applications, runtime object properties can change on various factors. Also, with Descriptive Programming (DP), regardless of what property you retrieve, it will always be a runtime property. Obviously, and I bet you know this, but just to reiterate, all these properties can be viewed from the Object Spy. You can find more information on it in my article Descriptive Programming 1. Below is a snapshot of the TO Properties Tab in Object Spy:
You will notice that even though I mentioned RO (RunTime Object) properties, I am looking at the TO (Test Object) tab. This is because, when we use the Object Spy to retrieve an objects’ properties, we are doing it on a runtime object, thus, what we see in the image above are all RunTime object properties with their image in the TO Object properties tab. We will use the GetROProperty method with TO properties.
Also, when writing custom checkpoints, we will (almost) always use RO properties instead of TO properties. That is because, we would like to know what the object contains at present, or at runtime as opposed to what the object contained during record time. However, if you are using Descriptive Programming, regardless of what property you retrieve from your application, it will be a runtime property.
The textbox below should have a value of 10, for the maxLength property. We will create a checkPoint to test that assumption.
If Browser("title:=.*Relevant.*").WebEdit("name:=txtMaxLen").GetROProperty("max length")=10 Then Reporter.ReportEvent micPass, "WebEdit MaxLength Text", "Test Passed." Else Reporter.ReportEvent micFail, "WebEdit MaxLength Text", "Test Failed." End If
Result:
When you open your Test Results after the above statement executes, you will notice that, the test failed. It will always fail because the maxLength for our WebEdit is not 10, but 9. When you you use Object spy to retrieve the max length property, you will notice that it is indeed not 10, but its 9. However, in the real-world, we may not always know the properties these objects will have at runtime, and most of the times you will come to find of errors after your regression suites complete their execution.
Let’s create another CheckPoint, and verify if the Link has the correct color:
With Browser("title:=.*Relevant Codes.*").Link("text:=Relevant Codes: Test Color") If .Exist(5) Then If .GetROProperty("color") = "#0000ff" Then Reporter.ReportEvent micPass, "RelevantCodes Link", "Correct color." Else Reporter.ReportEvent micFail, "RelevantCodes Link", "Incorrect color." End If Else Reporter.ReportEvent micFail, "RelevantCodes Link", "Link was not found." End If End With
Result:
CheckPoints for Multiple Objects
There are circumstances where you need to create CheckPoints for multiple objects at once. For instance, if you are creating a Login Function, you may need to create a CheckPoint for the UserName Textbox, Password Textbox and the Submit button. This section of the article details how CheckPoints can be created for multiple objects.
This article shows a way to verify multiple Object Properties through a single Class at once, and reports all Checks in a tabular form to QuickTest Results.
Below, you will see a scenario that I just mentioned above. These objects won’t do anything, but, they show a way you can create CheckPoints to be run for multiple objects together.
With Browser("title:=.*Relevant Codes.*").Page("micclass:=Page") If .WebEdit("name:=txtUser").Exist(1) And .WebEdit("name:=txtPassword").Exist(1) Then Reporter.ReportEvent micPass, "UserName/Password", "Objects found." Else Reporter.ReportEvent micFail, "UserName/Password", "Objects not found." End If End With
Similarly, if we want to verify objects’ properties instead of checking whether they exist, we can do this:
With Browser("title:=.*Relevant Codes.*").Page("micclass:=Page") If .WebEdit("name:=txtUser").GetROProperty("max length") = 9 And _ .WebEdit("name:=txtPassword").GetROProperty("max length") = 9 Then Reporter.ReportEvent micPass, "UserName/Password", "Correct MaxLength" Else Reporter.ReportEvent micFail, "UserName/Password", "Incorrect MaxLength" End If End With
QTP Results
CheckPoints for Hidden Objects
Let’s create another CheckPoint. This time, things will get a little complex. Below you will see a Textbox, but indeed there are 2. One of them is hidden. Is there a way to know that one of these Text boxes is hidden? The answer is: Yes.
With Browser("title:=.*Relevant Codes.*") 'If the first text box, that is, the text box with index 0 is hidden then.. set value in Text Box #2 If .WebEdit("name:=txtIsVisible", "index:=0").GetROProperty("visible") = False Then Browser("title:=.*Relevant Codes.*").WebEdit("name:=txtIsVisible", "index:=1").Set "2nd" Else 'Else, set value in Text Box #1 Browser("title:=.*Relevant Codes.*").WebEdit("name:=txtIsVisible", "index:=0").Set "1st" End If End With
In practice, many people make the mistake of omitting an ordinal identifier in such cases. When you run the same code without an ordinal identifier:
'Error MsgBox Browser("title:=.*Relevant Codes.*").WebEdit("name:=txtIsVisible").GetROProperty("visible")
You can generally run the following bit of code to find out which object is hidden:
Set oDesc = Description.Create oDesc("name").value = "txtIsVisible" Set colObject = Browser("title:=.*Relevant Codes.*").Page("micclass:=Page").ChildObjects(oDesc) For x = 0 to colObject.Count - 1 Print "Object " & x & ": " & colObject(x).GetROProperty("visible") Next
In your print log, you will have the following information:
'Object with Index = 0 is Hidden Object 0: False 'Object with Index = 1 is not Hidden Object 1: True
There are more ways to hide objects, and there are several techniques that can be used to spot them. However, I will let my readers explore those scenarios and find the many possibilities available to them.
I hope this article clarifies some doubts, and gives you more confidence using them in your everyday development.
{ 65 comments… read them below or add one }
In My Test I have 100 check points, How can I know the status/result of each check point in the test at run time. I want to print that stats in Excel sheet.
( I know we get the result of the check point can be known from the result viewer, but it is not used from my scenario).
Another is :
If Browser(“Order List”).Page(“Home Page”).Check(CheckPoint(“Home Page”)) = “Pass” Then
Msgbox “pass”
Else
MsgBox “Fail”
End If
“this also not suitable for me.
Plz give the Best solution for me.
408: How can the Data Table be used in a custom checkpoint? (Select two.)
Very important questions
A. To store output values
B. To store input parameters
C. To use formulas
D. To access global values
E. To compare columns
answer a,c
please suggest if these answers are correct and please share your explantion in the email adddress suggested
thanks a lot !!!
Adi
Hi Anshoo,
I have a query realted to Check column sorting in webtable. Please provide me logic, how can i start using DP
Thanks
Hari
Hi Anshoo,
Sub:
I am trying to understand QTP after 5
I have QTP 9.1 **** on Windows 7 on personal Lap.
After installation and **** i have verified all available check points use to work fine.
But after 30 Day’s when i am using the checkpoints, except “Standard Check Point” none is working on” Flight reservation app.
And getting “Logical name: Statis, Class: Static, Cannot create Bitmap Checkpoint. Unspecified error”
Can you put some light on this.
Hi,
I am calling a function which returns me a value i.e True/False.The function checks several checkpoints.So if one of the checkpoint fails my function should return false to the calling statement and should return true if all the checkpoints gets passed.Can you give me an example describing this?
hi anshu,
how can i change query for every iteration of qtp while using data base check points
HI Anshoo,
I want to use checkpoint in descriptive programming.How to use checkpoint in descriptive programming plz suggest me.
I am also trying for GetROProperty insted of checkpoint.I am getting following error—-
Object doesn’t support this property or method: ‘JavaWindow(…).JavaButton(…).GetROProperty’
Line (6): “JavaWindow(“PP”).JavaButton(“refresh”).GetROProperty(“enabled”)=1″.
Plz suggest me some answer.
Thanks
Arpita,
What is the output of the following line:
PS. You can’t use GetROProperty to equate it with a value without a conditional statement. The below statement is invalid:
It should be something like:
If JavaWindow(“PP”).JavaButton(“refresh”).GetROProperty(“enabled”)=1 Then 'do something End IfHi Anshoo,
I am getting below error if I try using check point (GetROProperty) in descriptive programming…
Object doesn’t support this property or method: ‘JavaWindow(…).JavaButton(…).GetROProperty’
Line (6): “JavaWindow(“PP”).JavaButton(“refresh”).GetROProperty(“enabled”)=1″.
Could you suggest anything here.
Thanks in advance
-Arpita
Custom Checkpoint, how to get the checkpoint name and the properties/values associated with it. I need to get them to a text results file. Any help
thanks in advance-anil
Anil,
Please read the chapter from Scripting QTP: Working with Files. It has several code examples showing how we can use QTP/VBScript to write content to text files.
hi,
u r right.. if the index changes then its difficult one to use that solution.
n apart from this use of regular expression is also gettting some problems.
Anshoo,
[a-z0-9]+ [a-z0-9]+
does not work and I tried that already.As this gives error of more than one matching and description is not unique.I came up with the solution by keeping either last name common or first name and last name of fixed length e.g of 5 characters any name and then tried using expression as:
[a-z]{5}[0-9]+.[a-z]{5}[0-9]+ (“.” is for space between first name and last name)
and this is working perfect now.Aprat from this index is the only solution.
What do you suggest ?
Thanks
Vivek
Hi Prasad,
From my side the solution for your problem is ;use index instead of innertext as on runtime the innertext will always change based on your given first name and last name.See below code:
————————————————————–
Set webDesc=Description.Create
webDesc(“html tag”).Value=”P”(spy the webelement and see html tag it may be different for you)
webDesc(“micclass”).Value=”WebElement”
webDesc(“index”).Value=2( this index you have to see by spying the webelement or if it does not show then add it in Object Repositary and see its index value)
msgbox Browser(“XYZ”).Page(“XYZ”).WebElement(webDesc).GetROProperty(“innertext”)
—————————————————————————————————————————–
Only problem which I see here is in case index changes you need to edit your code.
Other than that the another way of solution will be using the regular expression.But the problem here will be getting the exact expression is so hard are the first name and lastname will keep on changing.In my case I tried to fix it but so far I am not successful as it identifies other webelement.I am also waiting for Anshoo to reply on that as using regular expression it is hard to make the code work as first nameand last name will keep on changing in termsof length and it always fails.
So first soltuion is definetly going to work for you.
Lets wait for Anshoo to come on this.
Thanks
Vivek
hi vivek
thanks it worked
i had to add the index property of that webelement and set it to particular value like 1 (i set it)
and now its working fine..
is it right?
hi,
i have one doubt. like suppose there is one webelement, whose name and inner text is changing based on the values given at specific time.
let take one example -: say on one page u r asked to enter ur first name and surname and on the next page the message is framed like
[initial of ur firstname][space][lastname], welcome!!!
now in the above case that [initial of ur firstname][space][lastname] is webelement. so when u record it would take the value at that instance but when u run it with different values it gives error can’t recognize the webelement
e.g. initially while recording lets say i have give john nash and it is shown as J Nash, welcome!
so this time it have name as J Nash and inner text as J Nash
next time while runing i changed the value as kelly bell and now it has K Bell, welcome!
now this time it have name as K Bell and inner text as K Bell
and while running it gives the error.
as it doesnt find the webelement in the repository with the name J Nash
i tried using descriptive programming.
but still cant solve this one.
please help..
hi,
i have one doubt. like suppose there is one webelement, whose name and inner text is changing based on the values given at specific time.
let take one example -: say on one page u r asked to enter ur name and surname and on the next page the message is framed like
, welcome!!!
now in the above case that is webelement. so when u record it would take the value at that instance but when u run it with different values it gives error can’t recognize the webelement
e.g. initially while recording lets say i have give john nash and it is shown as J Nash, welcome!
so this time it have name as J Nash and inner text as J Nash
next time while runing i changed the value as kelly bell and now it has K Bell, welcome!
now this time it have name as K Bell and inner text as K Bell
and while running it gives the error.
as it doesnt find the webelement in the repository with the name J Nash
i tried using descriptive programming.
but still cant solve this one.
please help..
If you are using a DataTable, and you have the below 2 columns:
The values from the above columns can be used to create a string to check if that WebElement exists or not:
sInitial = Left(DataTable("FirstName", dtGlobalSheet), 1) sLastName = DataTable("LastName", dtGlobalSheet) Browser("").Page("").WebElement("innertext:=" & sInitial & " " & sLastName & ", welcome\!").HighlightHi,
Thanks Anshoo.It will certainly help me.I am getting the command over regular expression slowly and better than before.
I am able to do most of the webelement identification but having issue in this one .Can you give me right regular expression syntax for it:
The webelement is used for showing a customer name.I am passing the customer name unique from excel sheet which contains first name followed by number then last name followed by number.
e.g.
vivek001 kumar002 (name can be anything any length and number can be anything any length)
I tried;
[a-z0-9]+\b[a-z0-9]+ ; \b for space but it did not work
then tried
[a-z0-9]+.[a-z0-9]+ ; . for space but this too did not work
I thought I can keep first name last name constant and will change just the number so tried;
vivek[0-9]+/bkumar[0-9]+; this also did not work
may be i am using wrong syntax..can you help me
Thanks
Vivek
vivek.kumar2005@gmail.com
Try this:
Hi Anshoo thanks for reply.It seems you are online right now.I will try the way you gave me and let you know the result.In the mean time can you give me a good link/material to have good command over regular expression where for each kind of regular expression the example is given to understand it better.As in most cases I just find the theory of regular expression without support of any example.
Vivek: You may find this helpful. It covers most of the basics that you need to know to get started with ReGex. I hope this helps.
Hey Anshoo.After long time coming back to you though I keep visiting your website for reference.I have a query related with identifying “WebElement” on runtime.Basically one of the key is generated by the application on submitting the order.The key does not have any format and it does not have any fixed length character also.It can contain alphabets,number and hypen.I am not so good in regular expression.I do not know if this can help in identifying the id.The key is shown as WebElement and it is not inside any Web Table.The html tag P is for multiple web element.
Example of id:
b719dd3a-7db6-4f17-8f5d-b8bfe51adf6a
This webelement does not come under any webtable otherwise I could catch it using get cell data method.
I tried using Description.Create like;
————————————————————–
Set webDesc=Description.Create
webDesc(“html tag”).Value=”P”
webDesc(“micclass”).Value=”WebElement”
webDesc(“index”).Value=2
msgbox Browser(“XYZ”).Page(“XYZ”).WebElement(webDesc).GetROProperty(“innertext”)
—————————————————————————————————————————–
This does return the key but I am using the index as “2″ which may change tomorrow and this script will fail.
I can also add it to OR but again I will be dependent on index only.
Is there any other better way to make it work.
Do let me know.
Thanks
Vivek
Vivek,
Try this:
Set webDesc = Description.Craete webDesc("micclass").Value = "WebElement" webDesc("innertext").Value = "[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+-[a-z0-9]+" webDesc("index").Value = 0 msgbox Browser(“XYZ”).Page(“XYZ”).WebElement(webDesc).GetROProperty(“innertext”)Hello,
Any body knows how to create “Custom Bitmap Comparer” to validate bitmap checkpoint in QTP.
Thanks in Advance.
Regards,
Veera
Do you mean a Bitmap CheckPoint? What’s a Custom Bitmap Comparer – something like a custom built DLL or API?
Hi Anshoo,
I am using the concept of output values to display some values in the current datatable.
Now at runtime i am able to see the values in datatable.
These values are $123.00 till n numbers which i store in one column of datatable say x and $343.00 till n numbers which i store in other column of the datatable y.
I retrieve these values and store it in a variable using
sVariable = DataTable.LocalSheet.GetParameter(“x”).Value
sVariable1 = DataTable.LocalSheet.GetParameter(“y”).Value
Hence the value in sVariable and sVariable1 are $123.00 and $343.00 respectively
Now i want to add these 2 values and compare it with the value stored in the third column of datatable. Is it possible to do this?
Please suggest a method to add $123.00 and $343.00 so the final result can be $466.00.
Also the currency $ may change to pound or euro.
Hi Anshoo,
Great work!!!
“Reporter.ReportEvent EventStatus, ReportStepName, Details [, Reporter]”
Does sombody know how to use the last object in the above statement ? (….[, Reporter])
Here is the only sourse, where I could get this information, but it doesn’t work…
http://qtp.blogspot.com/2009/02/reporter-object.html
What version of QTP do you have, Boris? I think the last steps works only with version 9.5 or 10. It can be used to attach screen shots to QTP results.
Thanks for you help. When I did my further research on the window, I realized that QTP was recording two different static name depending on which Alert window came up first. If a Alert window for duplicate SSN came up first then it will take that Static name and use this to for other Alert windows. If Alert window came up for duplicate username then it will take Static name for this window and vice versa. Below are two different static window name which should been captured by QTP. Solution. I created a checkpoint in two separate window of QTP and moved over the QTP object respository to the actual where I will storing my scripts. is this a good way of doing it?
Static(“User with same SSN already”).Exist
Static(“Another record with the”).Exist Then
That is surely one way of doing it.
However, if the window (parent) is the same for both, you can also move them under it and use the same parent to work with both objects.
HI Anshoo,
I have this alert window that display indicating either the user is a duplicate or SSN number is a duplicate. The issue I have is that both the windows that states either ssn or user is a duplicate has same same window name (Static(“User with same SSN already exists in the database.”). even on the user alert window. I have not seen unique identifier for me to indicate that if one window exist then do something else. What is the best approach on this stituation where all of the windows name and IDs are the same.
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Static(“User with same SSN already”).Exist
SwfWindow(“ePDHA – You are currently”).SwfWindow(“Add User”).Dialog(“ePDHA – [Alert]“).Static(“User with same SSN already exists in the database.”).Check CheckPoint(“User with same SSN already exists in the database.”)
SwfWindow(“ePDHA – You are currently”).SwfWindow(“Add User”).Dialog(“ePDHA – [Alert]“).Static(“Another record with the same user name already exists in the database.”).Exist Then
SwfWindow(“ePDHA – You are currently”).SwfWindow(“Add User”).Dialog(“ePDHA – [Alert]“).Static(“Another record with the same user name already.”).Check CheckPoint(“Another record with the same user name already exists in the database.”)
SwfWindow(“ePDHA – You are currently”).SwfWindow(“Add User”).Dialog(“ePDHA – [Alert]“).Activate
I can think of 2 ways you can make this work:
1. For the description of the Dialog and/or Static, replace the description you have at hand with a Regular Expression that will run for both scenarios.
2. Use a Programmatic Description, that will enable you to avoid this error. For example:
With Dialog("regexpwndtitle:=.*Alert.*") If .Exist(0) Then If .Static("text:=.*same SSN.*").Exist(0) Then 'your code here MsgBox "Static Exists" End If End If End WithYour work done in this Blog is really really appreciated. I Dont know anything about QTP before reading this blog, but after started going through your presentations I gained lot of confidence. Thanks a Lot.
It would be better to arrange these presentations in a proper hierarchy , so that new learners can identify which should be learnt first and so on. This is the suggestion from my side.
I cannot see any other documents , websites etc.. having this much quality. Even many of them suggested to look into QTP help , but as a new learner it never helped me.
But after reading your presentations I am happy to learn everything step by step… :)
Thanks Once again …
Thank you, Pradeep. I’m happy to know that you found the content here useful.
Most of the articles that you see here are requests from readers of Relevant Codes, so it became hard to follow a pattern. Some of the articles I wrote, I never thought I would even write, but I did, and that created a messier pattern.
However, I can put a new post that can detail the recommended hierarchy to read these articles. Relevant Codes does not attract many readers, so I never thought this would be much of a concern, but since you have asked, I must get to work and get it done quick :)
Thank you Pradeep.
hello, i have one addition to Reporter object. Starting work with QTP 10 and found that is possible to add image to results. So the syntax for it looks like: Reporter.ReportEvent status, stepName, stepDescription, image. i have not tried it so far but it looks promissing. I am continue to read you website as time restrictions allows – it is a great pleasure to get such a good source of knowledge about automation. Regards
Thanks for bringing this up, Piotr. I wrote this article on QTP 9.5, but I have QTP 10.0 now, and I will update it.
Thank you :) I would have never realized that i have omitted this addition to the Reporter object from the article.
hey Anshoo i hv been following ur replies from other forums as well. thanks a ton !
it was simple. So, I can verify the position of the image by GetROProperty of x,y Co-ordinates. And I am guessing there is no other way than bitmapcheckpoint to verify the actual image.
and i think i can do this by
res= Browser(“XYZ”).Page(“ABC”).Image(“google”).Check CheckPoint(“google”)
where res is a boolen value ! thanks
I think you are correct. However, I have never encountered a situation where I had to check the Image’s contents, so I cannot be too sure. If I were to, I would also use a Bitmap Checkpoint myself.
This:
res= Browser("XYZ").Page("ABC").Image("google").Check CheckPoint("google")Should be:
'Notice the extra brackets before and after Checkpoint("") res= Browser("XYZ").Page("ABC").Image("google").Check (CheckPoint("google"))HI
I am trying to get my head around these checkpoints which i havent used anytime…can someone pls post an example for anyone checkpoint?
i have an appln where i need to test the position of the image and also verify if the right image is present in the appln..i have all the reqd images in an excel sheet…
now how do i use image/bitmap checkpoints to write my script?
Brower(“XYZ”).Page(“ABC”).Image(“google”).Check CheckPoint(“google”)
what to do after that?
Would you like to do it through Descriptive Programming or Object Repository? With GetROProperty, the concept will be the same for both.
Hi Anshoo,
Shreya again….You are doing a very good job. keep it up..I am learning qtp and referring your blog..its great and simple to understand..
Could you please guide me for my previously mentioned doubt?
Shreya
Please be a little patient. Sometimes it takes a little longer to reply to some queries than others. :)
Hey Anshoo..u got an awesome space …best QTP tutorial i hv seen ever. thanks for all the efforts. keep up the good work !
Thank you for your support, Nidhi. I’m glad that you like this website, and even more glad that you found the content here helpful.
Cheers- Anshoo
Hi Anshoo,
Can you guide me for when to use “Text checkpoint” and “Text Area Checkpoint” and which one is better with example (if possible)
Thanks in advance
Shreya
Hi Shreya,
The 2 excerpts below have been taken from the QTP Help File:
In short, the Text Area Checkpoint has a few limitations, with its primary one being that it cannot work with Web Application whereas a Text Checkpoint can. Also, when you create a Text Area Checkpoint, you will see a viewfinder that will help you select an area on the Window in which you would like to verify some text. Note: Text Area Checkpoint does not have a Checkpoint timeout! A Text Area Checkpoint window.
Below is the code you get when you create a checkpoint for an object:
Dialog("Dialog").Check CheckPoint("Login")Text Checkpoint on the other hand, creates a hand cursor that points to some text in any sort of application. A Text Checkpoint window.
Below is the code you get when you create a checkpoint for the same object as above:
Dialog("Login").Static("Agent Name:").Check CheckPoint("Agent Name:")There is very little difference in what they do in the end. In my opinion, it comes down to the level of flexibility you want from them, or the type of application that you’re working with. I would prefer the Text Checkpoint between the two, but in my automation, I never ever use Inbuilt Checkpoints. A custom checkpoint can cover everything an Inbuilt Checkpoint can, and more.
Hi,
I have one doubt about How to use Action Input parameter and output parameters in a multiple actions can u give me one example and explain the senario please
Sure, Satish. I will try my best to help you. I don’t use QTP’s inbuilt parameters much, so I am not sure how good I will be able to explain it but I will try to write an article in the coming few days. Thanks.
Thanks for the quick reply Anshoo. It would be great if you can give me idea in DP.
If you would like to retrieve the coordinates of the Google Image using Descriptive Programming:
Dim x, y x = Browser("title:=Google").Page("title:=Google")_ .Image("file name:=bert_ernie-hp.gif").GetROProperty("x") y = Browser("title:=Google").Page("title:=Google")_ .Image("file name:=bert_ernie-hp.gif").GetROProperty("y")However, the image might change the next time you run the same code because I have used its filename to identify it. A better approach would be to use its HTML_ID:
Dim x, y x = Browser("title:=Google").Page("title:=Google")_ .Image("html id:=logo").GetROProperty("x") y = Browser("title:=Google").Page("title:=Google")_ .Image("html id:=logo").GetROProperty("y")Sorry my fault for not entering the correct line of code.
If you noticed on the second line of code I have indicated a checkpoint on the window when I entered duplicate SSN and if entered duplicate username then code line 6 will indicate that I have entered a existing username. In these two statement both have a Static(“User with same SSN already”). Both of the windows have different messages, but have the same Static name. Based on the last response you indicated is that something feasible to do. Thanks for your help.
If SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Static(“User with same SSN already”).Exist Then
SwfWindow(” HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Static(“User with same SSN already”).Check CheckPoint(“User with same SSN already exists in the database.”)
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Activate
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).WinButton(“OK”).Click
Elseif SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Static(“User with same SSN already.”).Exist Then
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“ePDHA – [Alert]“).Activate
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Static(“User with same SSN already”).Check CheckPoint(“Another record with the same user name already exists in the database.”)
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).Activate
SwfWindow(“HA – You are currently”).SwfWindow(“Add User”).Dialog(“HA – [Alert]“).WinButton(“OK”).Click
Reporter.ReportEvent micFail, “Verify the user has been added”, “The” &username& “already exist”
Hi Puneet,
Did you get a chance to try the code in my previous comment? The thing is, since Dialog is a parent class of its own, it can be used the way I have used in my comment. Since its DP, you can carve out your own regular expression in it and make the same piece of code work for both scenarios.
Thanks a Lot Anshoo.. :-) :-)
You can just let me know which should be learnt first and so on. Since I will not be able to understand frameworks if I look into directly.
I will try to expedite this post, Pradeep :)
I would definitely start with VBScript, which I feel is a very important step in creating good frameworks.
Thank you for your reply.
I use QTP 9.5 …. and I know that it can be used to attach screen shots to QTP results. This is exactly what I need…
So my question is not what it does, but how it works ? Please give me a working example.
I have only one line. Could you tell me what is wrong in here ?
Reporter.ReportEvent micDone, “Test “, “Details”, ” C:\QTP_DATA\Test.jpg”
(… yes I have a .jpg file in the directory mentioned above)
I got “Type mismatch” error, though it works good without last (, ” C:\QTP_DATA\Test.jpg” )
Boris, just checked the review and the reason why its not working for you is that it was introduced with version 10..
Hello Anshoo,
Thanks for your reply, Here i mean how to develope Custom DLL (COM object) to validate the bitmap check point in QTP.
Regards,
Veera
I created my DLL with VB.NET. You can download the software here.
Great!!
Thats fine what you did.
Other than that I came up with other solution as this is only for testing purpose so you can manipulate the data to test and keep some assumption.
Lets say you keep the first name and last name always of fixed length e.g. 5 characters each ;example “vivek kumar” or you choose any length and us the following regular expression in Object Repositary in innertext section
[a-z]{5}[0-9]+.[a-z]{5}[0-9]+ (“.” is for space between first name and last name)
You can replace “5″ in both expression with digit you want to keep as fixed length.
Now your script will be able to identify the webelement.Try out and let me know in case you have any problem.
Thanks
Vivek
Prasad small change in above code as in my case first name and last name is followed by digit so you dont need it .Use the below expression:
[a-z]{5}.[a-z]{5} (“.” is for space between first name and last name)
Thanks
Vivek
In case there is any caps letter then use
[A-Za-z]{5}.[A-Za-z]{5} (“.” is for space between first name and last name)
thanks for youre respones but i need to get checkpoint name and the properties/values associated as primary objective. I have my function to write to txt files,
regards-anil
Anil,
If you have a custom CheckPoint, you will have to report any Property/Value with the Reporter object. The CheckPoint name will also be defined similarly.