Ejemplo n.º 1
0
class SetYimeCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        cls.user_log = UserLog()
        cls.logger = cls.user_log.get_logger()

    @classmethod
    def tearDownClass(cls) -> None:
        cls.user_log.close_file_handler()

    #前置条件
    def setUp(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.screen_x = self.coon.get_screen_x()
        self.screen_y = self.coon.get_screen_y()
        self.setTime_handle = SetTimeHandle(self.driver, self.screen_x,
                                            self.screen_y)
        self.myDevice_p = MyDevicePage(self.driver)

    def test_setTime(self):
        self.setTime_handle.enter_setTime()

    # 后置条件
    def tearDown(self):
        for method_name, error in self._outcome.errors:
            if error:
                case_name = self._testMethodName
                now = time.strftime("%Y-%m-%d %H-%M-%S")
                image_name = setting.TEST_ERROR_Image + '/' + case_name + " " + now + ".png"
                self.driver.save_screenshot(image_name)
        # self.driver.close()
        print("测试结束")
Ejemplo n.º 2
0
class H7130MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = [
            'H6075_BEA5',
        ]
        Ret1 = False  #日志打印串口是否创建成功标志
        Ret2 = False  #控制串口是否创建成功标志
        com1 = 'com14'
        bps = 115200
        timeout = 0.5
        com2 = "com12"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        self.h6075Main_h = H6075MainHandle(self.driver, self.device_name[0],
                                           com1, bps, timeout, Ret1)

    # 模式切换
    def test_mode_switch(self):
        times = 200
        try:
            self.h6075Main_h.mode_switch(times)
        except Exception as e:
            print(e)
Ejemplo n.º 3
0
class DingDingMainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.dingdingMain_h = DingDingMainHandle(self.driver)

    def test_1_learn(self):
        self.dingdingMain_h.learn()
Ejemplo n.º 4
0
class SetTempCase(unittest.TestCase):
    # @classmethod
    # def setUpClass(cls) -> None:
    #     cls.user_log = UserLog()
    #     cls.logger = cls.user_log.get_logger()
    #
    # @classmethod
    # def tearDownClass(cls) -> None:
    #     cls.user_log.close_file_handler()

    # 前置条件
    def setUp(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.setTemp_handle = SetTempHandle(self.driver)
        self.setTemp_p = SetTempPage(self.driver)

    # def test_01_setTemp_veal(self):
    #     self.setTemp_handle.setTemp_veal()
    #
    # def test_02_setTemp_beef(self):
    #     self.setTemp_handle.setTemp_beef()

    # def test_03_setTemp_pig(self):
    #     self.setTemp_handle.setTemp_pig()
    #
    # def test_04_setTemp_chicken(self):
    #     self.setTemp_handle.setTemp_chicken()
    #
    # def test_05_setTemp_turkey(self):
    #     self.setTemp_handle.setTemp_turkey()
    #
    # def test_06_setTemp_fish(self):
    #     self.setTemp_handle.setTemp_fish()

    def test_1_setTemp(self):
        # self.setTemp_handle.setTemp_beef()
        # self.setTemp_handle.setTemp_veal()
        # self.setTemp_handle.setTemp_pig()
        # self.setTemp_handle.setTemp_chicken()
        # self.setTemp_handle.setTemp_turkey()
        # self.setTemp_handle.setTemp_fish()
        self.setTemp_handle.setTemp_other()

    #后置条件
    def tearDown(self):
        for method_name, error in self._outcome.errors:
            if error:
                case_name = self._testMethodName
                now = time.strftime("%Y-%m-%d %H-%M-%S")
                image_name = setting.TEST_ERROR_Image + '/' + case_name + " " + now + ".png"
                self.driver.save_screenshot(image_name)
        #self.driver.close()
        print("测试结束")
Ejemplo n.º 5
0
class H6087MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = [
            'H6087_1D6F',
        ]
        # 日志
        self.user_log = UserLog(self.device_name[0])
        self.loger = self.user_log.get_logger()
        Ret1 = False  #日志打印串口是否创建成功标志
        Ret2 = False  #控制串口是否创建成功标志
        com1 = 'com6'
        bps = 115200
        timeout = 0.5
        com2 = "com12"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        self.h6087Main_h = H6087MainHandle(self.driver, self.device_name[0],
                                           com1, bps, timeout, com2, bps2,
                                           bytesize, stopbits, Ret1, Ret2)

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    #配网
    @unittest.skip('配网不执行')
    def test_1_connect_device(self):
        #是否跳过WiFi设置
        skip_wifi = True
        #测试次数
        times = 1000
        try:
            self.h6087Main_h.connect_H6087(skip_wifi, times)
        except Exception as e:
            print(e)
            self.loger.info(e)

    def test_2_modeChange(self):
        try:
            self.h6087Main_h.modeChange_H6087()
        except Exception as e:
            print(e)
            self.loger.info(e)
Ejemplo n.º 6
0
class H616BMainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.user_log = UserLog('H616B')
        self.logger = self.user_log.get_logger()
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.screen_x = self.coon.get_screen_x()
        self.screen_y = self.coon.get_screen_y()
        #设备名称
        self.device_name = ['H616B_5E80', 'H616B_2D64']
        self.h616BMain_h = H616BMainHandle(self.driver, self.screen_x, self.screen_y,self.logger,self.device_name[1])

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    # @unittest.skip('不执行')
    def test_ota(self):
        self.h616BMain_h.enter_H616B_main_face()
        times = 100
        n = 0
        for i in range(times):
            ota_result = self.h616BMain_h.ota()
            if ota_result:
                n += 1
                self.logger.info('第[%s]次OTA成功'%(i+1))
                print('第[%s]次OTA成功'%(i+1))
            else:
                self.logger.info('第[%s]次OTA失败'%(i+1))
                print('第[%s]次OTA失败'%(i+1))
        print('OTA升级[%s]次'%times+',成功了[%s]次!!!!!!!!' % n)
        self.logger.info('OTA升级[%s]次'%times+',成功了[%s]次!!!!!!!!' % n)

    # 后置条件
    def tearDown(self):
        # for method_name, error in self._outcome.errors:
        #     if error:
        #         case_name = self._testMethodName
        #         now = time.strftime("%Y-%m-%d %H-%M-%S")
        #         image_name = setting.TEST_ERROR_Image + '/' + case_name + " " + now + ".png"
        #         self.driver.save_screenshot(image_name)
        # self.driver.close()
        print("测试结束")
Ejemplo n.º 7
0
class Test5151Class(object):
    @classmethod
    def setup_class(self):
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = [
            'H5151_5F82',
        ]
        # 日志
        self.user_log = UserLog(self.device_name[0])
        self.loger = self.user_log.get_logger()
        Ret1 = False  # 日志打印串口是否创建成功标志
        Ret2 = False  # 控制串口是否创建成功标志
        com1 = 'com3'
        bps = 115200
        timeout = 0.5
        com2 = "com5"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        self.h5151Main_h = H5151MainHandle(self.driver, self.device_name[0],
                                           com1, bps, timeout, com2, bps2,
                                           bytesize, stopbits, Ret1, Ret2,
                                           self.loger)

    def setup_method(self):
        print("\n开始测试")

    @pytest.mark.run(order=1)
    def test_connect_device(self):
        #是否跳过WiFi设置
        skip_wifi = False
        #测试次数
        times = 200
        try:
            self.h5151Main_h.connect_H5151(skip_wifi, times)
        except Exception as e:
            print(e)
            self.loger.info(e)

    @pytest.mark.skip(reason='misunderstood the API')
    def test_ota(self):
        print('方法2')
Ejemplo n.º 8
0
class H7130MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = [
            'H5186_206B',
        ]
        Ret1 = False  #日志打印串口是否创建成功标志
        Ret2 = False  #控制串口是否创建成功标志
        com1 = 'com6'
        bps = 115200
        timeout = 0.5
        com2 = "com12"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        # self.meat_thermoment_h = Meat_ThermometerHandle(self.driver, self.device_name[0], com1, bps, timeout, com2, bps2, bytesize, stopbits,Ret1,Ret2)
        self.meat_thermoment_h = Meat_ThermometerHandle(
            self.driver, self.device_name[0], com2, bps2, bytesize, stopbits,
            Ret2, timeout, com1, bps, Ret1)

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    #进入设备主页
    @unittest.skip('不执行')
    def test_enter_device(self):
        times = 100
        try:
            self.meat_thermoment_h.enter_device(times=times)
        except Exception as e:
            print(e)

    def test_ota(self):
        times = 100
        try:
            self.meat_thermoment_h.ota(times=times)
        except Exception as e:
            print(e)
Ejemplo n.º 9
0
class H5183MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = [
            'H5181',
        ]
        # 日志
        self.user_log = UserLog(self.device_name[0])
        self.loger = self.user_log.get_logger()
        Ret1 = False  #日志打印串口是否创建成功标志
        Ret2 = False  #控制串口是否创建成功标志
        com1 = 'com6'
        bps = 115200
        timeout = 0.5
        com2 = "com30"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        self.h5183Main_h = H5183MainHandle(self.driver, self.device_name[0],
                                           com1, bps, timeout, com2, bps2,
                                           bytesize, stopbits, Ret1, Ret2)

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    # @unittest.skip('不执行')
    #ota
    def test_1_ota(self):
        #测试次数
        times = 2000
        try:
            self.h5183Main_h.ota(times)
        except Exception as e:
            print(e)
            self.loger.info(e)
        pass
Ejemplo n.º 10
0
class BleStabilityMainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = ['H5183', ]
        # 日志
        self.user_log = UserLog(self.device_name[0])
        self.loger = self.user_log.get_logger()
        self.bsm_h = BleStabilityHandle(self.driver,self.device_name[0])

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    def test_bleConnect(self):
        # 测试次数
        times = 1000
        try:
            self.bsm_h.bleconnect(times)
        except Exception as e:
            print(e)
Ejemplo n.º 11
0
class Thermo_HygrometerBoundClass(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        # 测试次数
        self.times = 3
        self.thermo_hygrometer_list = ['H5052_AC1C', 'H5051_6C7A', '5100']
        self.device_name = ['H7101_8027', 'H7111_F229']
        # 日志
        self.user_log = UserLog(self.device_name[0])
        self.loger = self.user_log.get_logger()
        self.thb_h = Thermo_HygrometerBoundHandle(self.driver, self.loger)

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    # @pytest.mark.run(order=1)
    def test_bound_device(self):
        try:
            self.thb_h.bound(self.device_name[0], self.times,
                             self.thermo_hygrometer_list)
        except Exception as e:
            print(e)
            self.loger.info(e)

    @unittest.skip('不执行')
    def test_bound_device2(self):
        try:
            # for i in range(len(self.device_name)):
            #     # self.thb_h.bound_thermo_hygrometer(self.device_name[i],self.times,self.thermo_hygrometer_list)
            self.thb_h.bound(self.device_name[1], self.times,
                             self.thermo_hygrometer_list)
        except Exception as e:
            print(e)
            self.loger.info(e)
Ejemplo n.º 12
0
class H7130MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = ['H7130_C583',]
        self.times = 300  # 测试次数
        Ret1 = False  #日志打印串口是否创建成功标志
        Ret2 = False  #控制串口是否创建成功标志
        com1 = 'com13'
        bps = 115200
        timeout = 0.5
        com2 = "com12"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        self.h7130Main_h = H7130MainHandle(self.driver, self.device_name[0], com1, bps, timeout, com2, bps2, bytesize, stopbits,Ret1,Ret2)

    # 配网
    def test_connect_device(self):
        try:
            self.h7130Main_h.connect_H7130(self.times)
        except Exception as e:
            print(e)
Ejemplo n.º 13
0
class DeviceConnectCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.user_log = UserLog()
        self.logger = self.user_log.get_logger()
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.screen_x = self.coon.get_screen_x()
        self.screen_y = self.coon.get_screen_y()
        self.deviceConnect_h = DeviceConnectHandle(self.driver, self.screen_x,
                                                   self.screen_y, self.logger)
        self.device_name = ['H6199_1540', 'H6199_1B2F']

    @classmethod
    def tearDownClass(self) -> None:
        self.user_log.close_file_handler()

    #前置条件
    def setUp(self) -> None:
        # self.adb_log.write_log()
        pass

    @unittest.skip("不执行")
    def test_connect_H5102(self):
        self.deviceConnect_h.connect_H5102()
        self.logger.info("---------连接H5102")
        #断言:对结果进行判断
        #self.assertTrue()

    @unittest.skip("不执行")
    def test_connect_H5103(self):
        self.deviceConnect_h.connect_H5103()
        self.logger.info("---------连接H5103")
        # 断言:对结果进行判断
        # self.assertTrue()

    @unittest.skip('不执行')
    def test_connect_H5182(self):
        self.deviceConnect_h.delete_H5182()
        self.logger.info("---------连接H5102")
        #断言:对结果进行判断
        #self.assertTrue()

    @unittest.skip('不执行')
    def test_connect_H5183(self):
        self.deviceConnect_h.connect_H5183()

    def test_connect_H6199(self):
        n = 0
        times = 500
        for i in range(times):
            try:
                connect = self.deviceConnect_h.connect_H6199(
                    self.device_name[1])
                if connect:
                    n += 1
                    self.logger.info('第[%s]次添加设备成功' % (i + 1))
                else:
                    self.logger.info('第[%s]次添加设备失败' % (i + 1))
            except Exception as e:
                self.logger.info(e)
        print('添加[%s]次,' % times + '成功了[%s]次!!!!!!!!' % n)
        self.logger.info('添加[%s]次,' % times + '成功了[%s]次!!!!!!!!' % n)

    @unittest.skip('不执行')
    def test_connect_H6056(self):
        n = 0
        for i in range(5):
            try:
                connect = self.deviceConnect_h.connect_sku6056()
                if connect:
                    n += 1
                    self.logger.info('添加设备成功')
                else:
                    self.logger.info('添加设备失败')
            except Exception as e:
                self.logger.info(e)
        print('添加5次,成功了[%s]次!!!!!!!!' % n)
        self.logger.info('添加5次,成功了[%s]次!!!!!!!!' % n)

    @unittest.skip('不执行')
    def test_connect_H6054(self):
        n = 0
        for i in range(5):
            try:
                connect = self.deviceConnect_h.connect_H6054()
                if connect:
                    n += 1
                    self.logger.info('第[%s]次添加设备成功' % (i + 1))
                else:
                    self.logger.info('第[%s]次添加设备失败' % (i + 1))
            except Exception as e:
                self.logger.info(e)
        print('添加5次,成功了[%s]次!!!!!!!!' % n)
        self.logger.info('添加5次,成功了[%s]次!!!!!!!!' % n)

    #后置条件
    def tearDown(self):
        for method_name, error in self._outcome.errors:
            if error:
                case_name = self._testMethodName
                now = time.strftime("%Y-%m-%d %H-%M-%S")
                image_name = setting.TEST_ERROR_Image + '/' + case_name + " " + now + ".png"
                self.driver.save_screenshot(image_name)
        # self.driver.close()
        print("测试结束")
Ejemplo n.º 14
0
class H6076MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.device_name = [
            'H6076_4B52',
        ]
        # 日志
        self.user_log = UserLog(self.device_name[0])
        self.loger = self.user_log.get_logger()
        Ret1 = False  #日志打印串口是否创建成功标志
        Ret2 = False  #控制串口是否创建成功标志
        com1 = 'com15'
        bps = 115200
        timeout = 0.5
        com2 = "com5"
        bps2 = 9600
        bytesize = 8
        stopbits = 1
        self.h6076Main_h = H6076MainHandle(self.driver, self.device_name[0],
                                           com1, bps, timeout, com2, bps2,
                                           bytesize, stopbits, Ret1, Ret2,
                                           self.loger)

    #前置条件
    def setUp(self) -> None:
        print('开始测试')

    #配网
    @unittest.skip('配网不执行')
    def test_1_connect_device(self):
        #是否跳过WiFi设置
        skip_wifi = False
        #测试次数
        times = 1
        try:
            self.h6076Main_h.connect_H6076(skip_wifi, times)
        except Exception as e:
            print(e)
            self.loger.info(e)

    #开关切换
    # @unittest.skip('开关切换不执行')
    def test_on_off_switch(self):
        #测试次数
        times = 6
        try:
            self.h6076Main_h.on_off_switch(times)
        except Exception as e:
            print(e)

    @unittest.skip('不执行')
    def test_enter_device(self):
        #测试次数
        times = 10
        try:
            self.h6076Main_h.enter_out_device_handle(times)
        except Exception as e:
            print(e)

    #颜色、色温切换
    @unittest.skip('颜色、色温切换不执行')
    def test_color_switch(self):
        #测试次数
        times = 100
        try:
            self.h6076Main_h.color_switch(times)
        except Exception as e:
            print(e)

    #亮度切换
    @unittest.skip('亮度切换不执行')
    def test_brightness_switch(self):
        #测试次数
        times = 30
        try:
            self.h6076Main_h.brightness_switch(times)
        except Exception as e:
            print(e)

    #灵敏度切换
    @unittest.skip('亮度切换不执行')
    def test_sensitivity_switch(self):
        #测试次数
        times = 2
        try:
            self.h6076Main_h.sensitivity_switch(times)
        except Exception as e:
            print(e)

    # 模式切换
    @unittest.skip('不执行')
    def test_mode_switch(self):
        #测试次数
        times = 100
        try:
            self.h6076Main_h.mode_switch(times)
        except Exception as e:
            print(e)
Ejemplo n.º 15
0
class H6199MainCase(unittest.TestCase):
    @classmethod
    def setUpClass(self) -> None:
        self.user_log = UserLog()
        self.logger = self.user_log.get_logger()
        self.coon = ConnectMobile()
        self.driver = self.coon.get_driver()
        self.screen_x = self.coon.get_screen_x()
        self.screen_y = self.coon.get_screen_y()
        self.h6199Main_h = H6199MainHandle(self.driver, self.screen_x,
                                           self.screen_y, self.logger)
        self.wifi_check_h = StatusCheckHandle(self.driver, self.logger)
        self.wifi_set_h = WIFISetHandle(self.driver, self.screen_x,
                                        self.screen_y, self.logger)
        self.device_name = ['H6199_1540', 'H6199_1B2F']

        #创建串口
        # self.port = com
        # self.bps = bps
        # self.timeout = timeout
        # global Ret
        # try:
        #     # 打开串口,并得到串口对象
        #     self.main_engine = serial.Serial(self.port, self.bps, timeout=self.timeout)
        #     self.main_engine.flushInput()  # 清空缓冲区
        #     # 判断是否打开成功
        #     if (self.main_engine.is_open):
        #         Ret = True
        # except Exception as e:
        #     print("---异常---:", e)

    @classmethod
    def tearDownClass(self) -> None:
        self.user_log.close_file_handler()

    #前置条件
    def setUp(self) -> None:
        # self.adb_log.write_log()
        pass

    #模式切换
    def test_mode_switch(self):
        try:
            self.h6199Main_h.mode_switch()
        except Exception as e:
            print(e)

    @unittest.skip('不执行')
    def test_ota(self):
        self.h6199Main_h.enter_H6199_1540_main_face()
        n = 0
        for i in range(200):
            ota_result = self.h6199Main_h.ota()
            if ota_result:
                n += 1
                self.logger.info('第[%s]次OTA成功' % (i + 1))
            else:
                self.logger.info('第[%s]次OTA失败' % (i + 1))
        print('OTA升级200次,成功了[%s]次!!!!!!!!' % n)
        self.logger.info('OTA升级200次,成功了[%s]次!!!!!!!!' % n)

    @unittest.skip('不执行')
    def test_wifi_check(self):
        n = 0
        for i in range(500):
            try:
                connect = self.wifi_check_h.goin_H6199()
                if connect:
                    n += 1
            except Exception as e:
                self.logger.info(e)
        self.logger.info('蓝牙连接测试500次,成功了[%s]次!!!!!!!!' % n)

    @unittest.skip('不执行')
    def test_wifi_set(self):
        n = 0
        times = 200
        for i in range(times):
            try:
                connect = self.wifi_set_h.connect_wifi(self.device_name[1])
                if connect:
                    n += 1
                    self.logger.info('第[%s]次WiFi连接成功' % (i + 1))
                else:
                    self.logger.info('第[%s]次WiFi连接失败' % (i + 1))
            except Exception as e:
                self.logger.info(e)
        print('连接[%s]次,' % times + '成功了[%s]次!!!!!!!!' % n)
        self.logger.info('连接[%s]次,' % times + '成功了[%s]次!!!!!!!!' % n)

    @unittest.skip('不执行')
    #不断进入WIFI设置页
    def test_enter_wifiSetting(self):
        try:
            self.h6199Main_h.enter_wifiSetting()
        except Exception as e:
            print(e)

    # # 接收串口数据
    # def recv(self):
    #     print("开始接收数据:")
    #     while True:
    #         try:
    #             count = self.main_engine.inWaiting()  # 获取串口缓冲区数据
    #             if count != 0:
    #                 data = self.main_engine.read(self.main_engine.in_waiting).decode("gbk")  # 读出串口数据,数据采用gbk编码
    #                 time.sleep(0.1)  # 延时0.1秒,免得CPU出问题
    #                 self.dataList += data
    #         except Exception as e:
    #             print("异常报错:", e)

    # 后置条件
    def tearDown(self):
        for method_name, error in self._outcome.errors:
            if error:
                case_name = self._testMethodName
                now = time.strftime("%Y-%m-%d %H-%M-%S")
                image_name = setting.TEST_ERROR_Image + '/' + case_name + " " + now + ".png"
                self.driver.save_screenshot(image_name)
        # self.driver.close()
        print("测试结束")