Micro Focus QTP (UFT) Forums
How to test the reset functionality in a page - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to test the reset functionality in a page (/Thread-How-to-test-the-reset-functionality-in-a-page)



How to test the reset functionality in a page - estherindu - 10-13-2009

Hi,

I have to verify the Reset button functionality in my application.

There are group of Web edit , web list, radio button object s present in a page,I have to pass the values and click on Reset button so that default values will be resetted.

CAn anyone sugget how to test n send me the code.

Thanks in advance


RE: How to test the reset functionality in a page - Saket - 10-14-2009

what kind of difficulties you are facing for this test?
You can just pass the values to your controls on the page using 'Set', 'Select' pr whatever applicable.
then click on reset button and check for each control whether they have reset or not as per the AUT functionality.

try with the above logic and let us know your issues if any.


RE: How to test the reset functionality in a page - estherindu - 10-14-2009

Hi Saket,

I am asking how to verify in QTP?

I have to write a script to test this functionality?


RE: How to test the reset functionality in a page - Saket - 10-14-2009

does the logic mentioned in my earlier post works?


RE: How to test the reset functionality in a page - estherindu - 10-27-2009

Thanks Saket.

Can u frame it in VB script and sent?

I have written script for Setting the values ,but once we click on reset button how to check whether the values have been reset or not?


RE: How to test the reset functionality in a page - Saket - 10-27-2009

Yes definitely, I can do this for you, But it may take time.
It is always a good idea to paste your lines of code whatever you have tried.
I will try to help you with your code itself and that will be much easier.

make sense? Smile


RE: How to test the reset functionality in a page - estherindu - 10-27-2009

First I thought of retriving all the default values and store into an excel,then To set the values and click on reset button.

Again store al the current values into an another excel,then comparing two excel sheets


''Create a Description object to help retrieve all WebEdit objects in a specific page.
Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "WebEdit"
''Retrieve all WebEdit objects from this page.
Set EditCollection = .Frame(setFrame("admin")).ChildObjects(oDesc)
NumberOfEdits = EditCollection.Count
For i = 0 To NumberOfEdits - 1
CurrentValue = EditCollection(i).GetROProperty("text")
Next



RE: How to test the reset functionality in a page - Saket - 10-28-2009

Yes you can do that with your logic, also rather creating an excel and compare you can store the values in arrays and compare the two arrays after reset.


RE: How to test the reset functionality in a page - venkatbatchu - 10-28-2009

Hi,
Just added few stuff to your code

Code:
Sub ChildObjects_Example()

Dim ValueToSet, NumberOfEdits
ValueToSet = " "
Set oDesc = Description.Create()
    oDesc("micclass").Value = "WebEdit"
Set EditCollection = Browser("xxx").Page("xxx").Frame("main").ChildObjects(oDesc)
NumberOfEdits = EditCollection.Count
msgbox NumberOfEdits
For i = 0 To NumberOfEdits -1
    If EditCollection(i).GetROProperty("micclass") = "WebEdit" Then
       EditCollection(i).Set ValueToSet  ('Here ValueToSet is empty i.e " "
    End If
Next
End Sub
Call ChildObjects_Example()



RE: How to test the reset functionality in a page - estherindu - 10-28-2009

Thanks much Saket n Venkat .

Here how to create an array with the size where we do not know the size?

Venkat as per your code we store the count intoan variable,so I have decalreda as below

Dim myarray(NumberOfEdits)

but while running it thrown an error saying a numeric need to be given.


please correct me If am wrong

Guys,

I have resolved the above issue
I was trying to get the value of text property instead of Value property.

Now my problem is Once I click on reset button,do I need to call the same function?
If yes the array values will be replaced with the new values as array is declared with in the function.

can u help me in comparing the arrays?