¿Cómo hacer/construir conjuntos de pruebas de Selenium más grandes?

I'm building tests for a suite of enterprise-ware. The good advice I had from the author of Test::WWW::Selenium was to build routines of larger functions and then parameterise them. So we have: add_user, post_blog and so on. These routines can then be enriched to check that the right text appears on pages and so on. This software is very configurable and we have tens of sites, all different. But these building blocks can be strung together and the driver data modified appropriately on a per-site basis.

Everything I've found out there on Selenium has been very beginner, nothing about building larger Test Suite. Is there anything beyond this or is this as good as it gets?

preguntado el 22 de mayo de 12 a las 16:05

Have you familiarized yourself with Page Objects? -

What are you using as programming language? Perl? -

Test::WWW::Selenium is a perl module, yes. -

1 Respuestas

It is very much possible to run very large number of selenium tests. In my organization we run around 200,000 to 300,000 tests per day across multiple websites. So yes its possible.

Note:- I code in JAVA and all the info below is from a JAVA perspective.

For a large scale testing using selenium to be successful, I would say it needs 3 basic components

  1. La infraestructura
  2. A good framework and easily maintainable code
  3. Easy and clear reporting


Your infrastructure should be able to support the huge load. We use selenium grid (if you are using Selenium 2 then its called as Grid 2.0) to achieve this. Selenium Grid allows us to run multiple tests in parallel and across multiple browsers. We use our own servers in which virtual machines are deployed to support this testing. There are vendors like Saucelabs.com to whom you can outsource the infrastructure maintenance.

Framework and testcode

Your framework must support multithreading and it should be threadsafe to utilize the selenium grid features. We use JAVA to make sure this happens. To run the tests in parallel pruebaNG is used. testNG can run multiple methods in parallel and all these tests will point to one single Hub. The hub would then distribute all these tests against multiple Remote Controls(RCs) connected to it.

When you have large set of tests, maintenance is inevitable. To reduce the rework effort due to a change in the application, its always better to follow the Page Object Model. Page object essentially means - each page in your application should have a corresponding class in your code. You will define all the elements and functions that can happen in that page in this class. This is a very modular and reusable structure. You can google for pageobject model and you will find many articles.


Its great to run 200,000 tests per day, but if you cannot showcase what failed and what passed in an easily accessible method your automation tests will not be of much use. There are multiple methods for this. From HTML reporting to building custom dashboards to show the results.

Once you have all these in place, then the only thing you will need is a tool to keep these tests running continuously. You can use any CI (continuous integration) tool to achieve this. Jenkins , Hudson , cruisecontrol are few of the CI tools that are mostly used.

contestado el 23 de mayo de 12 a las 05:05

Oooh, mapping a page to an object. Interesting. Does that lead to a massive proliferaition of classes though? Would you have a class for a set of pages that map to a function, say we have several pages that map to the "blog" feature? Yes we're using Jenkins and yes, the perl test harness supports parallelism on one machine at least. - david hodgkinson

Whether page object leads to a massive proliferation of classes or not depends on how you design it. If there is a feature which will be across multiple pages, you can create that as a a different page. In your case, you can create the 'blog' as a different page. You can then call this class from all the pages. And if the multiple sites that you test are similar in UI, you can create a common page first. Then extend that class to add the custom features of your each site. - AJ

As for the similarity of sites, I'm told the HTML templates are shared across the sites (and I'm hoping to get a LOT more id's in there!), however the data varies, for example number of address fields can vary and whole sections of the site may not be there. Thanks for the feedback. - david hodgkinson

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.