How to use test_success_check method in avocado

Best Python code snippet using avocado_python

runner_file.py

Source:runner_file.py Github

copy

Full Screen

1# encoding:utf82import time3import unittest4from base.html_test_runner import HtmlTestRunner5from login_shop_test import LoginShopTest6from shop_login_test import ShopLoginTest7# from order_check_one import OrderCheckTest8# from base.html_email_attachment import HtmlEmailAttachment9class ShopRunner():10 '''运行用例,并生成报告'''11 def runner(self):12 test_suite = unittest.TestSuite()13 print('实例化测试套件')14 test_suite.addTest(LoginShopTest('test_success_check'))15 report_path = '..\\report\\shop_tests_report_%s.html' \16 % time.strftime('%Y-%m-%d %H-%M-%S')17 report_file = open(report_path,mode='wb')18 test_runner = HtmlTestRunner(stream=report_file,19 title='销售子系统测试报告',20 description='测试详情')21 test_runner.run(test_suite)22 # HtmlEmailAttachment().email_attachment(report_path)23 # report_file.close()24 def runnerall(self):25 test_suit = unittest.TestSuite()26 tests = [LoginShopTest('test_success_check'),27 ShopLoginTest('test_success_check')28 ]29 test_suit.addTests(tests)30 report_path = '..\\report\\shop_tests_report_%s.html' \31 % time.strftime('%Y-%m-%d %H-%M-%S')32 report_file = open(report_path,mode='wd')33 test_runner = HtmlTestRunner(stream=report_file,34 title='销售子系统测试报告',35 description='测试详情')36 test_runner.run(test_suit)37 report_file.close()38if '__main__' == __name__:39 aa = ShopRunner()...

Full Screen

Full Screen

search_shop_test.py

Source:search_shop_test.py Github

copy

Full Screen

...11 # 输入网址12 self.driver.navigate('https://shop.10086.cn/mall_100_100.html')13 self.searchs = SearchComm(self.driver)14 self.login = ShopAfterLogin(self.driver)15 def test_success_check(self):16 '''断言,短信登录后购买手机'''17 driver = self.driver18 self.searchs.search()19 print('搜索商品')20 self.login.shop_num_login()21 print('登录账号')22 driver.sleep(5)23 text1 = driver.get_text('x,/html/body/div[6]/div[1]/div[1]')24 print(text1)25 if '+ 新增地址' not in text1:26 self.order.first_order_info()27 elif '+ 新增地址' in text1:28 self.order.edit_order_info()29 else:30 print('No elements found !')31 driver.click('x,/html/body/div[6]/form/div[2]/a/em')32 text = driver.get_text('x,/html/body/div[2]/div[1]/div[1]/p[1]/span[3]')33 print(text)34 self.assertEqual('提交成功,请您尽快付款!',text,'登录后购买手机失败')35 driver.get_screenshot('登录后购买手机成功')36if '__main__' == __name__:37 aa = SearchShopTest()...

Full Screen

Full Screen

login_shop_test.py

Source:login_shop_test.py Github

copy

Full Screen

...11 # 输入网址12 self.driver.navigate('https://shop.10086.cn/mall_100_100.html')13 self.shop = HomeShopPage(self.driver)14 self.login = ShopBeforeLogin(self.driver)15 def test_success_check(self):16 '''断言,短信登录后购买手机'''17 driver = self.driver18 self.login.num_shop_login()19 print('短信验证,成功登录移动商城')20 self.driver.get_screenshot('登录成功')21 self.driver.picture()22 # self.shop.shop_floor_page()23 # print('登录后,成功购买手机')24 # driver.sleep(5)25 # driver.click('x,/html/body/div[6]/form/div[2]/a/em')26 # # 登录后购买成功断言27 # driver.sleep(2)28 # text1 = driver.get_text('x,/html/body/div[2]/div[1]/div[1]/p[1]/span[3]')29 # print(text1)30 # self.assertEqual('提交成功,请您尽快付款!',text1,'登录后购买手机失败')31 # driver.get_screenshot('登录后购买手机成功')32if '__main__' == __name__:33 aa = LoginShopTest()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful