def sign_in(username, password): driver = browser() driver.get(Login_url) driver.maximize_window() XieFun = Login(driver) XieFun.username(username) XieFun.password(password) XieFun.button()
class login(unittest.TestCase): def setUp(self): self.driver = browser() self.driver.get(Login_url) self.driver.maximize_window() self.XieFun = Login(self.driver) @ddt.data(*test_data) def test1(self, data): self.XieFun.username(data['username']) self.XieFun.password(data['password']) self.XieFun.button() def tearDown(self): sleep(2) self.driver.quit()