Currently I am writing tests for a web application using Selenium, when a question popped in my mind. Since this is my first time with Selenium, I'd wish to have some help on it.

I have to test the creation and the functionality of a dropdown select list that will assign a ticket to a manager.
I have several different pages where this dropdown is displayed, my question is: should I test the functionality of the select list in every page?

I know (as programmer) that the code is the same in every page (actually the code is copied, we're creating tests in order to refactor safely and remove code duplication...), but the test doesn't, since it can only see the results on the page.

So, testing it on every page is an overkill or it's something required?

3 Answers 3


Yes you should for the fact that it is "copied". Sure it is supposed to stay the same but if it is not the exact same code there is no guarantee that someone will not change the implementation.

Write a test for that and then recall the same test method in every place instead of duplicating the test steps in every place. This will ensure it remains consistent.

Also if the control ever gets replaced in one place or another it will show that one of them is now different than before...which based on your writeup it shouldn't be different.


As you said that the code is copied in various pages, and I suppose there are different elements on each of those pages. Maybe those different elements may or may not have different impact on the drop down list. Or the drop down list may have different impact on those elements in each page. So it would be better to make sure that the functionality is working as intended in each page. You may not perform every validation applied to the field but you must check the working condition! :)


Your Selenium tests are focused on the integration of a number of pieces of your application. The questions you have answer are:

  • Did you copy the code right?
  • Did you copy the right code?
  • Did the code get wired up inside the page right?

It may help if you can factor out the part of your tests that is common to each of the pages. This allows you to check that

  1. The menu appears when it is "clicked"
  2. You can select a menu item
  3. The menu closes after the selection is made.

The tests that have to be done per-page include:

  • is the list of managers correct?
  • when you select a manager, did the ticket get assigned to that manager?

The tests that have to be done only once for the menu technology include:

  • The menu contains one or more items
  • The menu bounding box is appropriate for the list of items
  • If you have scrolling when the menu is larger than the screen, does it scroll properly?
  • Each menu item has a bounding box. Does clicking in the bounding box properly select the item, or, if you are using links instead, does clicking outside the link but inside the box have the appropriate reaction?
  • If you are using links, is the underlining consistent from one item to the next and consistent across menus? (This is an issue with IE browsers, as they treat link underlining differently than other inheritable styles)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.