verifying sorting in web driver

2,478 views
Skip to first unread message

mrigank ved

unread,
Aug 31, 2013, 10:54:20 PM8/31/13
to seleniu...@googlegroups.com
Hi all,

I have a scenario where I have to automate sorting functionality and verify that after clicking on sorting, column has been sorted.
this scenario I have to automate in webdriver.

Can any one give some help.

Thanks in advance.

Oscar Rieken

unread,
Aug 31, 2013, 11:15:10 PM8/31/13
to seleniu...@googlegroups.com
If you were doing it manually how would you verify that the list has been sorted after you click the button?


I would suggest to do the exact same thing  :)



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/567246a5-78b0-425b-9c97-184acaf6dad4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

mrigank ved

unread,
Aug 31, 2013, 11:58:10 PM8/31/13
to seleniu...@googlegroups.com
Thanks oscar ,but how we have to check that the first value in the row is in which order.
Shall I have to store the value and find out like the first value of the string stars with "A"?

Or any else check need to done.
Or you you can suggest some value add :)



technisoft adnan

unread,
Oct 25, 2013, 9:44:47 AM10/25/13
to seleniu...@googlegroups.com
did you get the solution? please share here of mail me.

David

unread,
Oct 28, 2013, 10:07:59 PM10/28/13
to seleniu...@googlegroups.com
General concept is you have to have a known state & fixed data (your data can't be dynamic every time you run it, otherwise, it can be hard to test for, unless the dynamic data is a date/time stamp that you can compare against - numerically compare timestamp value for greater/less than between starting row vs other rows, etc. and move along)

Once you have fixed data, you want to start from a known state (what sorting is the default? ascending/descending, etc.) If you know that the default sort will always be same, then good, otherwise to be safe, you can also force sorting to a given state to start from (unless you need to test default sort state). Then perform your sort and verify sort order.

You can verify sort order when you have fixed data as you know specifically what order it should always appear in. e.g. some row/cell will always be at row x when sorted A-Z and row y when sorted Z-A.

Exact method to verify sort depends on your grid/table implementation. Simply click whatever elements that cause a sort to occur, then simply follow up with a getText(), getAttribute(), etc. on some expected row A column B, asserting that it should contain the expected sorted value. Can do this for simply one row/cell or multiple. Failure of assertion means it wasn't sorted the way you expected.

You would assert the actual value that is extracted with getText(), getAttribute(), etc. against the expected value that is hard coded but configurable in your test data (e.g. in your test code as a variable/constant/page object locator, or in Java property file, CSV file, etc.)

http://lifegoeasy.blogspot.in/

unread,
Oct 29, 2013, 1:32:39 AM10/29/13
to seleniu...@googlegroups.com
Simple solution could be -
 1. Read data from column & store it in an array
 2. Sort this array (with same pattern as application sorts)
 3. Click operation on AUT
 4. Read value from column & save it in 2nd array
 5. compare value of both array

Adnan Ghaffar

unread,
Oct 29, 2013, 1:41:39 AM10/29/13
to seleniu...@googlegroups.com

How to verify the sorting by group Selenium Web-driver-java?

--
Regard,
Adnan Ghaffar Ch.
Software Quality Assurance Engineer and Analyst
TechniSoft
C o n s u l t i n g


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/UFa9bzto3VU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages