Skip to content

Instantly share code, notes, and snippets.

@santiycr
Created July 26, 2011 19:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santiycr/1107750 to your computer and use it in GitHub Desktop.
Save santiycr/1107750 to your computer and use it in GitHub Desktop.
Reporting pass/fail status automatically in Selenium 2 tests
class Selenium2TestCase(TestCase):
def report_pass_fail(self):
base64string = base64.encodestring('%s:%s' % (config['username'],
config['access-key']))[:-1]
result = json.dumps({'passed': self._exc_info() == (None, None, None)})
connection = httplib.HTTPConnection(self.config['host'])
connection.request('PUT', '/rest/v1/%s/jobs/%s' % (self.config['username'],
self.driver.session_id),
result,
headers={"Authorization": "Basic %s" % base64string})
result = connection.getresponse()
return result.status == 200
def tearDown(self):
self.report_pass_fail()
self.driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment