Selenium tests in zope3
for an actual project I am working on I decided to try selenium tests for expanding software quality. Selenium is an open source testing environment for your browser. Selenium makes the same stuff as you as a human would do for testing an application. It clicks throw the pages and verifies if a certain text appears or not. Because the tests run inside the browser it is the perfect environment for frontend developers because you can make cross-browser tests and you can test ajax driven applications (which is not possible with server side unit oder ftests).
for simple tests, the selenium IDE - a plugin for firefox - is a great tool to get a fast overview about the opportunities of selenium. But if you want to dive a little deeper, you will get out of luck with the html-styled testing format. I want to write tests in python language and then test the stuff inside selenium. For that the zc.selenium package - a zope3 package from zope corp - makes that done for you.
here is a small example for a test method - testing the search functionality on our new community portal:
def logout(self):
s = self.selenium
s.open(self.baseURL+’/@@logout.html’)
def login(self, user=’testmember’, passw=’tEsT’):
s = self.selenium
s.type(’login’, user)
s.type(’password’, passw)
s.clickAndWait(’SUBMIT’)
def reset(self):
s = self.selenium
self.logout()
s.open(self.baseURL)
def test_04_friends_search(self):
self.reset()
s = self.selenium
s.clickAndWait(’link=Suche’)
s.select(’search.gender’, ‘label=Mann’)
s.select(’search.ageRange’, ‘label=25 - 35′)
s.type(’search.zipCode’, ‘6850′)
s.clickAndWait(’search.actions.search’)
s.verifyTextPresent(’Manfred’)
as you can see you are able to access forms, test if a specific result was found etc. The advantage to write tests in python instead of the output html format is that you are able to create methods for default workflows like login logout etc.
thanks to zope corp and the selenium team for a cool job!
additional information:
- http://release.openqa.org/selenium-core/nightly/reference.html
- http://www.openqa.org/
- http://svn.zope.org/zc.selenium/
Who does what you do for video sites in Seattle (US)?
-bruce
hi bruce. sorry I do not understand your question :)
are you asking about somebody making selenium tests in seattle?
Just in case someone is, like me, wondering how to frickin’ run the tests. This got me the testrunner page:
http://localhost:8080/++resource++selenium/TestRunner.html
This can also be written as:
http://localhost:8080/@@/selenium/TestRunner.html