[Checkins] SVN: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/README.txt Updated readme on grok and wsgi layers, documented controlling gocept.selenium through environment variables.
Jan-Jaap Driessen
jdriessen at thehealthagency.com
Thu Dec 9 09:54:30 EST 2010
Log message for revision 118765:
Updated readme on grok and wsgi layers, documented controlling gocept.selenium through environment variables.
Changed:
U gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/README.txt
-=-
Modified: gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/README.txt
===================================================================
--- gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/README.txt 2010-12-09 14:12:05 UTC (rev 118764)
+++ gocept.selenium/branches/janjaapdriessen-wsgi/src/gocept/selenium/README.txt 2010-12-09 14:54:29 UTC (rev 118765)
@@ -15,11 +15,13 @@
buildout.cfg, using the extra ``ztk``, i.e. ``gocept.selenium[ztk]``.
2. Install Selenium RC by some means, e.g. by downloading a version from
- <http://release.seleniumhq.org/selenium-remote-control/>. We do not
- recommend using the ``collective.recipe.seleniumrc`` buildout recipe for
- this since we have had some bad experiences with it related to new
- versions of Selenium RC and Firefox.
+ `seleniumhq.org`_ . We do not recommend using the
+ ``collective.recipe.seleniumrc`` buildout recipe for
+ this since we have had some bad experiences with it related to new
+ versions of Selenium RC and Firefox.
+.. _`seleniumhq.org`: http://release.seleniumhq.org/selenium-remote-control
+
3. Run buildout to install gocept.selenium and selenium (the Python bindings
for Selenium RC).
@@ -69,15 +71,83 @@
need a separate one for the Selenium tests.
1. Use the ``grok`` extra when requiring gocept.selenium.
+
4. Create a layer for your tests::
- import gocept.selenium.grok
+ import gocept.selenium.grok
- selenium_layer = gocept.selenium.grok.Layer(my.package)
+ selenium_layer = gocept.selenium.grok.Layer(my.package)
-5. Inherit from `gocept.selenium.grok.TestCase` (not ztk).
+5. Inherit from `gocept.selenium.grok.TestCase`. You will probably want to
+ setup your app in your test setup::
+ import transaction
+ class MyTest(gocept.selenium.grok.TestCase):
+ layer = selenium_layer
+
+ def setUp(self):
+ super(MyTest, self).setUp()
+ root = self.getRootFolder()
+ root['app'] = mypackage.App()
+ transaction.commit()
+
+ def test(self):
+ self.selenium.open('/app')
+ self.selenium.assertBodyText('foo')
+
+The Grok Layer is based on a WSGI layer. You can test WSGI applications with
+gocept.selenium by following the steps described above and substituting:
+
+1. Use the ``wsgi`` extra when requiring gocept.selenium.
+
+4. Create a layer for your tests::
+
+ import gocept.selenium.wsgi
+
+ from mypackage import App
+
+ test_layer = gocept.selenium.wsgi.Layer(App())
+
+5. Inherit from `gocept.selenium.wsgi.TestCase`::
+
+ class TestWSGITestCase(gocept.selenium.wsgi.TestCase):
+
+ layer = test_layer
+
+Controlling gocept.selenium through environment variables
+---------------------------------------------------------
+
+You can configure the selenium server that gocept.selenium connects to from the
+command line. Selenium RC defaults to localhost:4444, but you can also connect
+to a selenium grid in your organization by using the following environment
+variables::
+
+ GOCEPT_SELENIUM_SERVER_HOST=selenium.mycompany.com
+ GOCEPT_SELENIUM_SERVER_PORT=8888
+
+If multiple browsers are connected to your selenium grid, you can choose the
+browser to run the tests with as such::
+
+ GOCEPT_SELENIUM_BROWSER=*iexplore
+
+When you are running your selenium tests on a selenium grid, you need to
+instruct the browser which host and port to connect to::
+
+ GOCEPT_SELENIUM_APP_HOST=10.0.0.15
+ GOCEPT_SELENIUM_APP_PORT=8001
+
+When you are testing an application on one machine, you can access the running
+application from another machine if you set ``GOCEPT_SELENIUM_APP_HOST = 0.0.0.0``
+instead of the default ``localhost``.
+
+You can set the speed with which the tests are run through an environment
+variable::
+
+ GOCEPT_SELENIUM_SPEED=500
+
+This example will introduce a 500 millisecond pause between tests.
+
Similar packages
----------------
@@ -91,5 +161,5 @@
Get the latest source with ::
- svn co http://svn.gocept.com/repos/gocept/gocept.selenium/trunk gocept.selenium
+ svn co http://svn.zope.org/repos/main/gocept.selenium/trunk gocept.selenium
More information about the checkins
mailing list