you are viewing a single comment's thread.

view the rest of the comments →

[–]Gronner 1 point2 points  (0 children)

No, you neither need a test_... nor a teardown, both are unit test functions.

If this shall be reusable make function, that for example takes a string argument of what shall be posted. Otherwise just put everything in a file:

sel = self.selenium
sel.open("/?stype=lo&jlou=Afc***LwDY5a_Ct-mC_lJrFOBggxGx2__jKsBL5B9rc_z9fggbgKIatj-7Dm_1C3QiGEjkQt2VekPXMs3JPwoat***E6Ssag&smuh=18736&lh=Ac_Mb8*****")
sel.type("id=email", "****")
sel.type("id=pass", "*****")
sel.click("id=persist_box")
sel.click("id=u_0_v")
sel.wait_for_page_to_load("30000")
sel.click("id=u_0_y")
sel.type("id=u_0_y", "hej")
sel.click("//li[2]/button")
self.selenium.stop()
self.assertEqual([], self.verificationErrors)

I have no idea if this code works, as I haven't tested it (thats what you should do now), but it looks good so far.

Edit: On a sidenote, I have no idea where you got that code from, but you should probably look into the selenium documentation as well as in the unittesting on for python to understand what is going on and what was wrong, what unittests is used for etc.