Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Detailed Documentation

Supported options

The recipe supports the following options:

seleniumversion

The version of selenium to use, the version numbers can be taken from http://release.seleniumhq.org/selenium-remote-control/. Default: nightlyBuild.

eggs

The eggs to include in the runner path. Any product included in the path will be accessible for the runner to search and run selenium tests from.

java-cmd

The command used to run the selenium server. Default: java.

Example usage

The basic buildout that uses the recipe should look like the following:

>>> write('buildout.cfg',
... """
... [buildout]
... parts = seleniumenv
...
... [seleniumenv]
... recipe = rcom.recipe.seleniumenv
... seleniumversion = 1.0-beta-2
... eggs = ${instance:eggs}

The seleniumrunner script

The selenium runner is a script to find and run selenium tests, it will be on your bin directory once the recipe is installed It receives different parameters and it’s main objective is to simplify the tests execution and reporting procedure. This script will wake-up the selenium RC server, search and run the tests and then shutdown the server and report the tests result. Once the recipe has been installed, a tests runner should be placed on the bin directory

Running the tests

To run the suite of tests bundled with any product, the first thing to do after the buildout has been run is to prepare a Plone site to test (if the user doesn’t have a Plone site to test, yet). For this to be done, you must first wake up the instance:

./bin/instance start

To run all the selenium tests for a product the user should pass at least two parameters:

-i instance

The Plone site’s name.

-s product

The product in which the runner will search for tests to run.

An example test execution will be:

$ ./bin/seleniumrunner -i testPloneSite -s namespace.product

This will search all the selenium tests for the product and run them on http://localhost:<port_used>/testPloneSite.

For running a particular test, the -t parameter should be passed to the runner:

$ ./bin/seleniumrunner -i testPloneSite -s namespace.product -t exampleTest

Creating a test

The seleniumrunner script will look for all the classes that inherit from unittest.TestCase on a specified package or module located under this kind of path:

namespace.product/namespace/product/tests/seleniumtests
Tests development guidelines

To create a test, there are certain basic rules to follow:

  1. The test should inherit from unittest.TestCase class (this can be done indirectly also).

  2. The test should use certain global variables for the code to work on different environments and Plone instances. These are:

    • browser: For the browser used for the tests

    • port: For the port used to communicate with the server

    • url: For the url of the application under test

    • instance: The Plone site name (this depends on the name used for the site’s creation).

This variables should never be changed inside the test code, as the seleniumrunner script will set them at runtime according with the parameters received.

All this rules can be seen applied to the following Example test.

Example test

The following is an example test, it can be used as the basic structure for future tests:

from selenium import selenium
import unittest

class NewTest(unittest.TestCase):
    def setUp(self):
        self.verificationErrors = []
        self.selenium = selenium("localhost", port, browser, url)
        self.selenium.start()

    def test_new(self):
        sel = self.selenium
                        sel.open(instance + "/login.html")
        # Do specific tests in here

    def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)

Notice that the test doesn’t have much changes from the basic test exported using Selenium IDE, the firefox extension. The only difference are the variables used for the instantiation inside the setUp method.

Contributors

Santiago Suarez Ordoñez, Author Juan Pablo Gimenez, Contributor

Change history

0.1 (2009-01-05)

  • Created recipe with ZopeSkel [Santiago Suarez Ordoñez].

1.0 (2009-02-14)

  • Ended code changes and uploaded the egg to pypi [Santiago Suarez Ordoñez].

Download

Release files for rcom.recipe.seleniumenv 1.0dev-r4475

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rcom.recipe.seleniumenv 1.0dev-r4475
File Size Uploaded
rcom.recipe.seleniumenv-1.0dev-r4475.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rcom.recipe.seleniumenv 1.0dev-r4475
File Interpreter ABI Platform
rcom.recipe.seleniumenv-1.0dev_r4475-py2.5.egg Legacy Egg format - - Details

Total release size:47.4 kB

Release files / rcom.recipe.seleniumenv-1.0dev-r4475.tar.gz

Download URL rcom.recipe.seleniumenv-1.0dev-r4475.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
969dd6ce227af82e933b41f506ea3c4aa332ab97685d92e2f2997e0ad9519b6f
BLAKE2b-256 checksum
How to use checksums
84e1f0de8aca8f5c364d02e00adc36b2352011a620ba15b3411aae71cdcba41e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rcom.recipe.seleniumenv-1.0dev_r4475-py2.5.egg

Download URL rcom.recipe.seleniumenv-1.0dev_r4475-py2.5.egg
Size 32.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
a532cf78a9fc45b01357b8620915a5c272237789a9fca8b94437146e3318044a
BLAKE2b-256 checksum
How to use checksums
27c42668ed585622ac0829add3a872e0bd4ba38e8323c3abe833a38a5654695d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0

This release

1.0dev-r4475 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page