def test_login(self): """test login with data driver""" if self.username is None: self.username = '' if self.password is None: self.password = '' logger.start_testcase('Testing %s' % self.cell['testcase ID'].value) loginPage.enter_username(self.username) logger.info('Enter useranme: "%s"' % self.username) loginPage.enter_password(self.password) logger.info('Enter password: "******"' % self.password) mepage = loginPage.login() logger.info('click the Login button') time.sleep(0.5) wd.get_screenshot_as_file('test_result/' + self.cell['testcase ID'].value + '.png') if mepage.is_load: logger.info('%s %s' % (self.cell['testcase ID'].value, '(success to login)')) wd.get_screenshot_as_file('test_result/' + self.cell['testcase ID'].value + '_success.png') self.wb.write_result(self.cell['result'], 'TRUE') else: logger.info('%s %s' % (self.cell['testcase ID'].value, '(fail to login)')) self.wb.write_result(self.cell['result'], 'FALSE') assert_true(self.wb.compare_expected(self.cell['expected'], self.cell['result'], self.cell['PASS/FAIL']))
def close_and_save(): """save the result to excel and quit the app""" logger.after_test('Finish YY Fin loging test') wb.save('test_result/login_test_result.xlsx') logger.info('Save the testing results to login_test_result.xlsx') wd.quit() logger.info('Close testing APP') logger.end_testcase()
def setup(): """open login page""" global wd, loginPage wd = MobileDriver.get_driver() logger.before_test('Init YY Fin login test') logger.info('YY Fin App launched') loginPage = LoginPage(wd) loginPage.open() logger.info('Open the login page') assert_true(loginPage.is_load)
def test_search(self): u"""测试Bing搜索功能""" logger.start_testcase('Bing test case') logger.info('test bing search') logger.end_testcase() self.assertEqual(True, True)
def test_search(self): u"""测试Google搜索功能""" logger.start_testcase('google test case') logger.info('test google search') logger.end_testcase() self.assertEqual(True, True)
def test_search(self): u"""测试百度搜索功能""" logger.start_testcase('Baidu test case') logger.info('test baidu search') logger.end_testcase() self.assertEqual(True, True)