class WiFiConnect(UIATestBase): """ @summary: used to test test wifi connect function """ def setUp(self): super(WiFiConnect, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name cfg_file = 'tests.tablet.google_fast.conf' self.wifi = WifiSettingImpl(\ self.config.read(cfg_file, 'wificonnect')) self.wifi.set_orientation_n() def tearDown(self): super(WiFiConnect, self).tearDown() print "[Teardown]: %s" % self._test_name def testWiFiConnect(self): """ This test used to test create a note function. The test case spec is following: 1. Launch the "setting" and connect a wifi. 2. verify that connect a ap success. """ print "[RunTest]: %s" % self.__str__() self.wifi.wifi_connect()
def setUp(self): super(WiFiConnect, self).setUp() self._test_name = __name__ print "[Setup]: %s" % self._test_name cfg_file = 'tests.tablet.google_fast.conf' self.wifi = WifiSettingImpl(\ self.config.read(cfg_file, 'wificonnect')) self.wifi.set_orientation_n()
def setUp(self): super(WifiReconnectDuringGOTA, self).setUp() self._test_name = __name__ cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), 'tests.tablet.gota.conf') self.cfg = self.config.read(cfg_file, 'gota') self.gota = gotaImpl(self.cfg) print "[Setup]: %s" % self._test_name self.ssid = self.config.read(cfg_file, 'wifisetting').get("ssid") self.passwd = self.config.read(cfg_file, 'wifisetting').get("passwd") self.serial = g_common_obj2.getSerialNumber() self.wifi = WifiSettingImpl(self.config.read(cfg_file, 'wifisetting'))
def setUp(self): super(AnTuTuTest, self).setUp() self.logger = Logger.getlogger(__name__) self._test_name = __name__ self.logger.info("[Setup]: %s" % self._test_name) cfg_file = 'tests.tablet.pnp.conf' #init function object self.wifi = WifiSettingImpl(self.config.read(cfg_file, 'wifisetting')) self.pnp = PnpImpl() self.antutu = AntutuImpl(self.config.read(cfg_file, 'antutu')) self._init_env()
class WifiReconnectDuringGOTA(UIATestBase): """ @summary: reliability test """ def setUp(self): super(WifiReconnectDuringGOTA, self).setUp() self._test_name = __name__ cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), 'tests.tablet.gota.conf') self.cfg = self.config.read(cfg_file, 'gota') self.gota = gotaImpl(self.cfg) print "[Setup]: %s" % self._test_name self.ssid = self.config.read(cfg_file, 'wifisetting').get("ssid") self.passwd = self.config.read(cfg_file, 'wifisetting').get("passwd") self.serial = g_common_obj2.getSerialNumber() self.wifi = WifiSettingImpl(self.config.read(cfg_file, 'wifisetting')) def tearDown(self): print "[Teardown]: %s" % self._test_name super(WifiReconnectDuringGOTA, self).tearDown() self.cfg = None def testWifiReconnectDuringGOTA(self): print "[RunTest]: %s" % self.__str__() #flash DUT and skip boot the wizard base_build = self.cfg.get("base_build") self.gota.phone_flash_tool_build_zip_file(base_build) self.gota.push_uiautomator_jar() g_common_obj.set_vertical_screen() TestDevice().skip_initial_screen_after_factory_reset() self.gota.enable_developer_option() self.gota.keep_awake() self.gota.close_lock_screen() self.gota.accept_unknow_resource() self.gota.unverify_apps_over_USB() #check the fingerprint before gota Fingerprint_before_GOTA = os.popen( "adb -s %s shell getprop ro.build.fingerprint" % self.serial).read() Fingerprint_before_GOTA = Fingerprint_before_GOTA.replace("\n", "", 1) self.gota.insert_info("Fingerprint before GOTA", Fingerprint_before_GOTA) print "[INFO] --- check the fingerprint before gota is: %s" % Fingerprint_before_GOTA #connect AP print "self.ssid: %s" % self.ssid print "self.passwd: %s" % self.passwd if self.ssid == None: print "using default ap setting" self.gota.connect_AP("SHZ13F-OTC-irda101", "zxcvbnm!?") else: print "using config ap setting" self.gota.connect_AP(self.ssid, self.passwd) print "[Info] --- Connect ap before gota" #check downloading gota package self.gota.downloading_screen_exist() #turn off and turn on Wi-Fi self.wifi.launch_from_am() self.wifi.turn_off_wifi() time.sleep(10) self.wifi.launch_from_am() self.wifi.turn_on_wifi() #download and install GOTA package self.gota.download_package_and_auto_retry() self.gota.restart_and_install_package() #check the fingerprint after gota Fingerprint_after_GOTA = os.popen( "adb -s %s shell getprop ro.build.fingerprint" % self.serial).read() Fingerprint_after_GOTA = Fingerprint_after_GOTA.replace("\n", "", 1) self.gota.insert_info("Fingerprint after GOTA", Fingerprint_after_GOTA) print "[INFO] --- check the fingerprint before gota is: %s" % Fingerprint_after_GOTA
class AnTuTuTest(RenderAppTestBase): """ @summary: The basic function to test antutu """ @classmethod def setUpClass(self): """ install apk """ super(AnTuTuTest, self).setUpClass() config = TestConfig() cfg_file = 'tests.tablet.artifactory.conf' cfg_arti = config.read(cfg_file, 'artifactory') config_handle = ConfigHandle() cfg_arti["location"] = config_handle.read_configuration( 'artifactory', 'location', '/etc/oat/', 'sys.conf') cfg = config.read(cfg_file, 'content_antutu') arti = Artifactory(cfg_arti.get('location')) apk_name = cfg.get("name") file_path = arti.get(apk_name) g_common_obj.adb_cmd_common('install ' + file_path) @classmethod def tearDownClass(self): """ uninstall apk """ super(AnTuTuTest, self).tearDownClass() def setUp(self): super(AnTuTuTest, self).setUp() self.logger = Logger.getlogger(__name__) self._test_name = __name__ self.logger.info("[Setup]: %s" % self._test_name) cfg_file = 'tests.tablet.pnp.conf' #init function object self.wifi = WifiSettingImpl(self.config.read(cfg_file, 'wifisetting')) self.pnp = PnpImpl() self.antutu = AntutuImpl(self.config.read(cfg_file, 'antutu')) self._init_env() def tearDown(self): self.logger.info("[Teardown]: %s" % self._test_name) super(AnTuTuTest, self).tearDown() #uninstall antutu #self.apk.apk_uninstall(self.apk_name) self.pnp.freeze_rotation() def testAnTuTu(self): """ This test used to test AnTuTu """ self.logger.info("[RunTest]: %s" % self.__str__()) self.antutu.test() def _init_env(self): """ init test env """ self.pnp.check_device() g_common_obj.root_on_device() g_common_obj.remount_device() #turn off wifi self.wifi.launch_from_am() self.wifi.turn_off_wifi() #uninstall old app self.pnp.rotate_device_n()