[Checkins] SVN: gocept.selenium/branches/jw-move-selenium-browser-to-testcasebase/src/gocept/selenium/base.py Move the browser selection from the test layer to the testcase baseclass in order to be more flexible in choosing the browser. As a consequence, the browser is started multiple times which is slower, but it will be easier to run the tests against multiple browser types by merely subclassing the concrete testcases and setting a different browser attribute.
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Jun 2 04:32:01 EDT 2010
Log message for revision 112898:
Move the browser selection from the test layer to the testcase baseclass in order to be more flexible in choosing the browser. As a consequence, the browser is started multiple times which is slower, but it will be easier to run the tests against multiple browser types by merely subclassing the concrete testcases and setting a different browser attribute.
Changed:
U gocept.selenium/branches/jw-move-selenium-browser-to-testcasebase/src/gocept/selenium/base.py
-=-
Modified: gocept.selenium/branches/jw-move-selenium-browser-to-testcasebase/src/gocept/selenium/base.py
===================================================================
--- gocept.selenium/branches/jw-move-selenium-browser-to-testcasebase/src/gocept/selenium/base.py 2010-06-02 07:26:59 UTC (rev 112897)
+++ gocept.selenium/branches/jw-move-selenium-browser-to-testcasebase/src/gocept/selenium/base.py 2010-06-02 08:32:01 UTC (rev 112898)
@@ -17,12 +17,6 @@
class Layer(object):
- # XXX make configurable:
- # hostname and port of the Selenium RC server
- _server = 'localhost'
- _port = 4444
- _browser = '*firefox'
-
# override in subclass:
# hostname and port of the app web server
host = None
@@ -35,22 +29,32 @@
self.__name__ = '.'.join(x.__name__ for x in bases) + '.selenium'
def setUp(self):
- self.selenium = selenium.selenium(
- self._server, self._port, self._browser,
- 'http://%s:%s/' % (self.host, self.port))
- self.selenium.start()
+ pass
- def tearDown(self):
- self.selenium.stop()
-
def switch_db(self):
raise NotImplemented
class TestCase(object):
+ # XXX make configurable:
+ # hostname and port of the Selenium RC server
+ _server = 'localhost'
+ _port = 4444
+
+ browser = '*firefox'
+
def setUp(self):
super(TestCase, self).setUp()
+ url = 'http://%s:%s/' % (self.layer.host, self.layer.port)
+ self._selenium = selenium.selenium(
+ self._server, self._port, self.browser, url)
+ self._selenium.start()
+
+ self.selenium = gocept.selenium.selenese.Selenese(self._selenium, self)
+
self.layer.switch_db()
- self.selenium = gocept.selenium.selenese.Selenese(
- self.layer.selenium, self)
+
+ def tearDown(self):
+ self._selenium.stop()
+ super(TestCase, self).tearDown()
More information about the checkins
mailing list