Hi, the Drupal software project uses simpletest for functional tests. But we'd like to have more site specific tests for drupal.org and the sub-sites.

Could we install Selenium on our staging servers so we can record, and re-run selenium tests on our staging sites? We can capture selenium tests and migrate them to generic site specific function simple tests over time if that's helpful. But I'd like to test drupal.org quirks without having to have our QA team write functional tests in PHP for Drupal.org quirks.

Comments

gerhard killesreiter’s picture

I thought selenium was a browser plugin?

damien tournoud’s picture

Actually, setting up selenium functional tests do not require anything from the infrastructure side.

Could you elaborate on what you think is required from us?

shyamala’s picture

Are we looking at integrating Selenium with PHP unit tests or Simple tests using the Selenium Module?

Are there specific usecases that we should try out before using the same on our servers?

drumm’s picture

Title: Add Selenium to Drupal.org so QA team can produce repeatable site specific testing » Write Selenium tests for Drupal.org

As others have mentioned, Selenium is a browser plugin, not something that goes on the server.

There are some services that automate testing on multiple platforms. Our current infrastructure doesn't have a lot of spare space and is Linux-only. I recommend using a 3rd-party service rather than trying to run our own.

However, this is all useless without actual Selenium tests built.

shyamala’s picture

We could use Selenium to build Automated Regression tests for Drupal.org. IT's is the next Generation Automated testing tool.
With Selenium RC and Selenium Grid, Selenium is more than just a browser plugin.

Would the next step be to create a a list of Regression testing that is required to be run on Drupal.org?

Below is a short note about Selenium:
The Selenium-IDE provides for a browser plugin to develop test cases.These tests can then be exported to any supported programming language.

Selenium RC comes in two parts.
A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them.
Client libraries for your favorite computer language.

Selenium Grid: Coordinates multiple Selenium RC at the same time, to help speed test feedback.
"In-browser tests are inherently slow, but since commodity hardware is insanely cheap nowadays there is no excuse for not running all these tests in parallel on multiple machines and dramatically speeding up your feedback cycle. This is exactly what Selenium Grid is about."

gerhard killesreiter’s picture

I am all for having such tests, but before we invest in extra hardware for them, I'd like to see some actual tests.

So, the first step would be to get a number of people to gether who would want to work on this, then collaborate in drawing up lists of needed tests, and then write some tests.

Also, d.o doesn't change all that frequently, so I am not sure if we'd really need these tests frequently.

shyamala’s picture

Interested in building Selenium tests signup at http://groups.drupal.org/node/129939

rfay’s picture

subscribe.

greggles’s picture

Subscribe - I am building basic tests for security.drupal.org (verifying access)

p0deje’s picture

I suppose it's better to use Selenium 2 WebDriver as long as RC won't be further developed.

Also, my offer is to use Page-Object pattern (or even BDD). I already have classes for Homepage, LoginPage, AccountPage etc. for clean Drupal 6 installation. I can update them for Drupal.org. NB: they are written in Python.

Examples:

class Homepage():
    def __init__(self, webdriver):
        self.browser = webdriver
        
    def go_to_login(self):
        """Goes to login page."""
        self.browser.get('/user/login')
        return LoginPage(self.browser)

    def go_to_account(self):
        """Goes to My Account page."""
        self.browser.find_element_by_link_text('My account').click()
        return AccountPage(self.browser)

    def logout(self):
        """Logs user out."""
        self.browser.find_element_by_link_text('Log out').click()
        return self


class LoginPage():
    def __init__(self, webdriver):
        self.browser = webdriver

    def login(self, username, password):
        """Logs user in with username and password."""
        # prepare fields
        username_field = self.browser.find_element_by_id('edit-name')
        password_field = self.browser.find_element_by_id('edit-pass')
        # enter credentials
        username_field.send_keys(username)
        password_field.send_keys(password)
        # submit form
        username_field.submit()
        return AccountPage(self.browser)

    def request_new_password(self, username):
        """Requests new password with username (or email address)."""
        # prepare field
        username_field = self.browser.find_element_by_id('edit-name')
        # enter credentials
        username_field.send_keys(username)
        # submit
        username_field.submit()
        return self

    def register(self, username, email):
        """Registers new user with username and email."""
        # prepare fields
        username_field = self.browser.find_element_by_id('edit-name')
        email_field = self.browser.find_element_by_id('edit-email')
        # enter credentials
        username_field.send_keys(username)
        email_field.send_keys(email)
        # submit
        username_field.submit()
        return Homepage(self.browser)
killes@www.drop.org’s picture

Wouldn't behat be easier?

eliza411’s picture

Status: Active » Fixed

I think that the behat tests we have at https://drupal.org/project/doobie can probably allow us to close this as fixed. Would always love a hand improving those!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.