Tuesday, December 20, 2011

Conception of how to do a Testing Suite with Selenium

Thoughts on organizing and starting an Automated Suite from ground up.
  1. Develop test scripts using webdriver (although it is still in its early stages, this is where selenium is headed).
  2. Develop in Python. Reason for this is that the language/platform used for the website is Python/Django. Once developers are in-house, they can be asked some questions if needed.
  3. Split out everything possible to the smallest possible elements (such as 'selecting a dropdown' would be part of my company's selenium library, same as 'login', 'logout' scripts)
  4. Create a Page class that stores all the paths to elements used in current script. When the path is changed, it will be very easy to change it once it's there.
  5. Develop error catching to make it as explicit as possible so that there is no need to dig in as to what actually happened and where it happened (plan is to use screen shot capture capability for most non-obvious errors)
  6. Additionally there will be a need for time measurements to get the approximate feel for how long will it take for pages to load. This will be stored with each sequential running of the test to see if it's going down/up/etc.
The way I see the tests being is
--> General Script that calls a lot of minor scripts
             Example: "Login", "Run Send Email Script", "Run Check sent email script", "Logout"
  --> Specific Scripts will contain general actions (they will see the 'Page' class)
        These scripts will contain parameters such as user name, password, any other relevant parameters (so that they can be re-used if needed).
                   Example: "Login" script will have 'driver.find_element_by_css_selector(email_input).click()'
    --> Page class will contain the actual paths to the elements (css when possible, with comments if it's not)
                 Example: "email_input" will be email_input="input.id_email"