In a Web appl, on a page, there are student names & details
listed.On clicking sort button,details are sorted on
Names.How do u verify htat sorting is done by using QTP?



In a Web appl, on a page, there are student names & details listed.On clicking sort button,det..

Answer / ankur_jain

you can use this function for comparing the values and if
your records are shown in webtable then you can use code
like this
in blank spaces between " " you have to pass your own
names
set hp=browser(" ").page(" ")
rc=browser(" ").page(" ").webtable(" ").rowcount
For i=2 to rc step 1
If i=rc Then
sone=hp.webtable(" ").getcelldata(i,1)
stwo=hp.webtable("html id:=dgList").getcelldata(i,1)
end if
sone=hp.webtable(" ").getcelldata(i,1)
stwo=hp.webtable(" ").getcelldata(i+1,1)
ret= CompareValues(sone, stwo)
'then on the basis of ret value you can verify that
list is sorted or not

'Using this function you can compare two values.
'Return values are based on three data types -Date,Numeric
or Text
'Return 1 if value1>value2 OR -1 if value1<value2, 0 if
value1=value2

Function CompareValues(sOne, sTwo) '--- as variant
On Error Resume Next

Dim im1,im2, iRtrn

if (isNumeric(Trim(sOne)) AND isNumeric(Trim(sTwo)))
then
im1 = CDbl(Trim(sOne))
im2 = CDbl(Trim(sTwo))
else
if (isDate(Trim(sOne)) AND isDate(Trim(sTwo))) then
im1 = CDate(Trim(sOne))
im2 = CDate(Trim(sTwo))
else
im1 = Trim(CSTR(sOne))
im2 = Trim(CSTR(sTwo))
end if
end if

iRtrn=0
If im1 < im2 then
iRtrn = -1
else
if im1 > im2 then
iRtrn = 1
end if
end if
CompareValues = iRtrn

If Err.Number > 0 then
strErrorMsg = "Error occured in function
CompareValues "
strErrorMsg = strErrorMsg & "Parameter
values passed to the function are: - ( " & sOne & ", " &
sTwo & ")"
Call ErrorHandler(strErrorMsg)
End If

End Function

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More QTP Interview Questions

After running scripts how you report results ,there is any specific report form

1 Answers  


If u don't have any Knowledge on perticular application but they give that application to u for Testing ? Then How we wil move towards testing on that application?

16 Answers   Genpact, HP,


can we call runaction in the funcion

1 Answers  


Does we use Classes and methods in realtime..?How wud we access methods in a class..?Thanq Guys..!

3 Answers  


Suppose you are using shared objects repository in your test and you want to split your present action? At that time shared object repository is single or it’s also splits?

0 Answers  






draw the qtp frame work?

0 Answers  


Can we do Load Teting with QTP?

12 Answers  


hi all, I have installed QTP successfully on windows vista. I am able to record and run on windows applications, but facing problem with web applications. While recording, I am able to open the web application, but when I click on any object or give login name and password, the events are not getting recorded in QTP. Could anyone solve the problem. Any settings to be done for web applications other than selecting web-addin? Waiting for replies. Thanks in advance.

4 Answers  


how do check the links in a webpage ?

7 Answers   Accenture, Wipro,


Is it possible to change the extension of Shared object repository?

2 Answers  


I have two actions in my QTP test and two iterations in my DataSheet. I want to execute the Action 1 for the two iterations only after which i want to exceute the next Action2. How is this possible?

4 Answers  


Which object repository we use in real time and can we merge 2 object repostiory and how?

3 Answers  


Categories