def ACS_Initiate_Connection(self): try: self.System_Operation_Data() self.Click_Serial_Number() time.sleep(2) selenium.click( "link="+config_element.get("system", "system_message_queue")) print "Click the message queue" for i in range(2): selenium.click( "xpath="+config_element.get("system", "system_refresh_button")) print "Click the refresh " + str(i+1) + " times" # Verify the SetParameterValues text can be get # time.sleep(1) # Wait the 1 sec for get the acs parametervalues text on 106/06/11 setParameterValues = selenium.get_text( "xpath="+config_element.get("detail_message", "acs_parametervalues_text")) if setParameterValues == 'SetParameterValues': print 'Get the SetParameterValues text!!' else: print "Do not Get the SetParameterValues text!!" android = Android() android.Copy_Trace_Folder() raise Exception("Do not Get the SetParameterValues text!!") self.Autoit_Tab_button(38, 200) autoit.Sleep(2000) autoit.Send("{ENTER}") print 'Click the ACS TCP Initiate Connection was finished' autoit.Sleep(2000) # IE 9 autoit.WinWaitActive( "[title:ACS Notify Page - Windows Internet Explorer]", "") autoit.ControlClick( "ACS Notify Page - Windows Internet Explorer", "", "ToolbarWindow321") self.Autoit_Tab_button(4, 100) autoit.Sleep(2000) autoit.Send("{ENTER}") autoit.Sleep(2000) delete_subfolder = Delete_Subfolder() delete_subfolder.Delete_Path_Subfolder("..\\..\\Result\\femtolog") adbClient = AdbClient() time.sleep(2) adbClient.Swiandroidh_ACS() autoit.WinClose("[class:IEFrame]") # Click the refresh button for i in range(1): selenium.click( "xpath="+config_element.get("system", "system_refresh_button")) print "Click the refresh " + str(i+1) + " times" autoit.Sleep(2000) print "Click the acs initiate connectin button" except: raise Exception("The ace initiate button was not click - FAIL")
def iperf_AN(self): android = Android() adbClient = AdbClient() adbClient.swiandroidh_iperf() iperf_command = "-s -i -5" android.mobile_device_connect() android.service_iperf_start(iperf_command) android.iperf_log_clean() adbClient.client_iperf_start() adbClient.adb_event("4") android.screen_shot_save(iperf_command) android.mobile_device_disconnect() adbClient.move_file("Down_androidP_")
def test_Iperf_TCP_Na(self): rs232_putty = RS232_Putty() rs232_putty.RS232_Connect_Putty() os.system("adb shell am force-stop com.magicandroidapps.iperf") android = Android() adbClient = AdbClient() for i in range(1,int(config.get("setting","run_times"))+1): for j in range(1,int(config.get("iperf_setting", "times"))+1): self.Del_File("result.txt") iperf_command = "-s -i 5" # adbClient.Swiandroidh_Iperf() self.Mobile_Device_Connect() self.Killall_Iperf() adbClient.Service_Iperf_Start_N('iperf '+iperf_command) self.Iperf_Log_Clean() adbClient.Iperf_Client() adbClient.Getfile_Command_Iperf() os.system("adb shell input keyevent 4") android.Screen_Shot_Save("iperf_tcp_na") android.Mobile_Device_Disconnect() adbClient.Strip_Split_Iperf() adbClient.Move_File("Down_") adbClient.Split_Move_File("Down_split_")
def test_Ftp_Download_With_Handy(self): os.system("adb shell am force-stop com.ftpcafe") os.system("adb shell am force-stop com.anite.handy") android = Android() adbClient = AdbClient() run_times = config.get("setting", "run_times") times = config.get("ftp_setting", "times") filename = config.get("ftp_setting", "filename_handy") filestart = config.get("ftp_setting", "filename_handy") fileend = config.get("ftp_setting", "filename_handy_size") print "NB Server & android Client (ftp loop download)" for i in range(1, int(run_times) + 1): for j in range(1, int(times) + 1): self.Swiandroidh_FtpClient() self.Mobile_Device_Connect() # adbClient.Download_Over() # android.Ftp_Creat_Account() #*******************Download from 10.1.107.213***************** # print 'Donwload Times: ' + str(j) # self.Ftplog_Renew() # self.Ftp_Autoselect_Server('server') # self.Ftp_Connect() # self.Verify_Ftp_Connect() # self.Folder_Select("Downloads") # self.Ftp_Download(filename) #****************** Download from speed.hine.net*************** self.Ftp_Autoselect_Server('hinet') self.Ftp_Connect() self.Verify_Ftp_Connect() print 'Donwload Times: ' + str(j) time.sleep(10) self.Ftp_Download(filename) #*******************Handy function **************************** self.Swiandroidh_Handy() self.Mobile_Device_Connect() time.sleep(28) print "mobile_device_connect is success." time.sleep(1) self.Switch_Voice_Quality(j) self.Handy_Start_Script() time.sleep(1) self.Handy_Run_Script() print "Run script." time.sleep(112) self.Screen_Shot_Save("Volte") time.sleep(25) self.Handy_Keep_Log() time.sleep(5) self.Get_Handy_Folder() android.Mobile_Device_Disconnect() print "mobile_device_disconnect"
def test_Ftp_Upload_Server(self): os.system("adb shell am force-stop com.ftpcafe") android = Android() adbClient = AdbClient() run_times = config.get("setting","run_times") times = config.get("ftp_setting","times") filename = config.get("ftp_setting", "filename_upload") filestart = config.get("ftp_setting", "filename_upload") fileend = config.get("ftp_setting", "filename_upload_size") print "NB Server & android Client (ftp loop upload)" adbClient.Swiandroidh_FtpClient() for i in range(1,int(run_times)+1): self.Mobile_Device_Connect() # adbClient.Download_Over() # android.Ftp_Creat_Account() for j in range(1,int(times)+1): print 'Upload Times: ' + str(i) self.Ftplog_Renew() self.Ftp_Autoselect_Server('server') self.Ftp_Connect() self.Verify_Ftp_Connect() self.Folder_Select("Uploads") self.Ftp_Localfolder() self.ADB_Event("123") self.ADB_Event("123") self.Folder_Select("Uploads") self.Ftp_Upload(filename) self.Transfer_Status(filestart,fileend) self.Getfile_Command() self.Check_File_Status() self.ADB_Event("4") self.Screen_Shot_Save("FTP_Upload") self.FTP_Urate() self.ADB_Event("66") self.ADB_Event("66") self.ADB_Event("111") self.ADB_Event("111") self.ADB_Event("111") self.mobile_device_disconnect() print "mobile_device_disconnect"
def Speed_Test(self, filename): android = Android() adbClient = AdbClient() print "Speed_Test" # adbClient.Swiandroidh_Speedtest() android.Mobile_Device_Connect() time.sleep(2) android.Verify_Speed() time.sleep(40) android.Speed_Download() android.Speed_Upload() android.Screen_Shot_Save(filename) android.Mobile_Device_Disconnect()
def setUp(self): print 'Start by Automated execution.' global scp, ssh, rs232_putty global android, adbClient, uiautomator_control global reboot_command, customer_nl_local, customer_remote global plmn global boolean scp = SCP() ssh = SSH() rs232_putty = RS232_Putty() uiautomator_control = Uiautomator_Control() android = Android() adbClient = AdbClient() reboot_command = './rsys/scripts/reboot-fap' customer_nl_local = 'customer.nl' customer_remote = 'customer.rcS' plmn = "123-45"
def test_Ftp_Download_Server(self): os.system("adb shell am force-stop com.ftpcafe") android = Android() adbClient = AdbClient() run_times = config.get("setting", "run_times") times = config.get("ftp_setting", "times") filename = config.get("ftp_setting", "filename_download") filestart = config.get("ftp_setting", "filename_download") fileend = config.get("ftp_setting", "filename_download_size") print "NB Server & android Client (ftp loop download)" self.Swiandroidh_FtpClient() for i in range(1, int(run_times) + 1): android.Mobile_Device_Connect() # self.Download_Over() # self.Ftp_Creat_Account() for j in range(1, int(times) + 1): print 'Donwload Times: ' + str(j) self.Ftplog_Renew() self.Ftp_Autoselect_Server('server') self.Ftp_Connect() self.Verify_Ftp_Connect() self.Folder_Select("Downloads") self.Ftp_Download(filename) print "The filename is " + filename self.Del_File("..\..\\Result\\log\\vsftpd.log") self.Transfer_Status(filestart, fileend) self.Getfile_Command() self.Check_File_Status() self.ADB_Event("4") self.Screen_Shot_Save("FTP_Download") self.FTP_Drate() self.ADB_Event("66") self.ADB_Event("66") self.ADB_Event("111") self.ADB_Event("111") self.ADB_Event("111") self.Mobile_Device_Disconnect() print "mobile_device_disconnect"
def test_Iperf_TCP_An(self): rs232_putty = RS232_Putty() rs232_putty.RS232_Connect_Putty() os.system("adb shell am force-stop com.magicandroidapps.iperf") android = Android() adbClient = AdbClient() for i in range(1, int(config.get("setting", "run_times")) + 1): for j in range(1, int(config.get("iperf_setting", "times")) + 1): adbClient.Del_File("result.txt") iperf_command = "-s -i 5" time.sleep(2) # adbClient.Swiandroidh_Iperf() android.Mobile_Device_Connect() android.Service_Iperf_Start(iperf_command) android.Iperf_Log_Clean() adbClient.Get_Android_IP() adbClient.Client_Iperf_Start() android.Screen_Shot_Save("iperf_tcp_an") android.Mobile_Device_Disconnect() adbClient.Strip_Split_Iperf() adbClient.Move_File("Up_") adbClient.Split_Move_File("Up_split_")
def FTP_NA_Download(self): android = Android() adbClient = AdbClient() filename = "1.pdf" filestart = "/1.pdf" fileend = "104857600 bytes" print "NB Server & android Client (ftp download)" adbClient.swiandroidh_FtpClient() adbClient.ftplog_renew() android.mobile_device_connect() adbClient.download_over() android.ftp_creataccount() android.ftp_connect() android.Verify_ftp_connect() android.folder_select("Download") android.ftp_download(filename) adbClient.Transfer_Status(filestart, fileend) adbClient.getfile_command() adbClient.Check_FileStatus() adbClient.adb_event("4") android.screen_shot_save("FTP_Download") adbClient.FTP_Drate() android.mobile_device_disconnect()
def test_Adminstate(self): webcontrol = Webcontrol() android = Android() android.Check_Mobile_Nexus() adbClient = AdbClient() cpu = System_Status() uiautomator_control = Uiautomator_Control() rs232 = RS232_Putty() rs232.RS232_Connect_Putty() for cycle_times in range( int(config_setting.get("cycle_times", "times"))): os.system("taskkill /F /IM iexplore.exe") print 'The Cycle times : ' + str(cycle_times + 1) cpu.cpu_percentage() cpu.used_memory() cpu.free_memory() boolean = config_setting.get("setting", "boolean") for runtime in range(int(config.get("adminstate_setting", "times"))): print 'The Run Times : ' + str(runtime + 1) + ', Set value = ' + boolean print 'Adminstate\'s testcase...' status = config_setting.get("setting", "status") heMS_SetParameterValues = config_element.get( "location", "heMS_SetParameterValues") heNB_SetParameterValuesResponse = config_element.get( "location", "heNB_SetParameterValuesResponse") cpu.cpu_percentage() cpu.used_memory() cpu.free_memory() webcontrol.Initial() webcontrol.Login() webcontrol.Clear_All_Data( config_element.get("system", "system_message_queue"), config_element.get("delete_file", "delete_all_message_queue_button"), "Delete Message successfully!") ###### Cell wait time ###### # wait 30s, until to cell was launched, the device auto connected total used 90s # # wait 15s, until to cell was not launched, the device auto disconnected total used 20s # adbClient.Start_Airplane() webcontrol.Parameter_List_Adminstate(boolean) webcontrol.ACS_Initiate_Connection() webcontrol.HeNS_Request_Message(boolean, heMS_SetParameterValues) webcontrol.HeNB_Response_Message( status, heNB_SetParameterValuesResponse) adbClient.Stop_Airplane() ############################################################### webcontrol.Security_Logout() time.sleep(1) webcontrol.Exit() cpu.cpu_percentage() cpu.used_memory() cpu.free_memory() time.sleep(1) print 'SpeetTest\'s testcase...' os.system( "adb shell am force-stop org.zwanoo.android.speedtest") uiautomator_control.Restart_ADB() android.Check_Mobile_Nexus() uiautomator_control.Switch_Home() uiautomator_control.Switch_Setting() uiautomator_control.Switch_More() uiautomator_control.Switch_Cellular_Networks() uiautomator_control.Switch_Network_Operators() if boolean == "0": uiautomator_control.Click_Device_Value0() if boolean == "1": uiautomator_control.Click_Device_Value1("nexus") uiautomator_control.Switch_Home() uiautomator_control.Restart_ADB() print 'The setting was finished' if boolean == "1": uiautomator_control.SpeedTest_True("Nexus5x_Speed") cpu.cpu_percentage() cpu.used_memory() cpu.free_memory() boolean = "1" rs232.RS232_Disconnect_Putty() print '\nThe Cycle time is : ' + config_setting.get( "cycle_times", "times") + ' times.\nFinished.'
def iperf_NA_U52(self): adbClient = AdbClient() UP_UDP = "52m" adbClient.swiandroidh_iperf() adbClient.service_iperfU_start() adbClient.iperf_client_U(UP_UDP) adbClient.get_file() adbClient.Check_iStatus(local_file) adbClient.move_file("UP_UDP_")
def test_Earfcn(self): android = Android() android.Check_Mobile_Note4() rs232 = RS232_Putty() rs232.RS232_Connect_Putty() heMS_SetParameterValues = config_element.get( "location", "heMS_SetParameterValues") print 'Earfcn\'s testcase...' for cycle_times in range( int(config_setting.get("cycle_times", "times"))): print 'The Cycle times : ' + str(cycle_times + 1) earfcn = config_setting.get("setting", "earfcn") frequency = config.get("cellmapper_setting", "frequency") # Click the EarfcnDL and EarfcnFL via RF folder for runtime in range(int(config.get("earfcn_setting", "times"))): os.system("taskkill /F /IM iexplore.exe") print 'The Run Times : ' + str(runtime + 1) print 'Earfcn of ACS : ' + earfcn + ' Frequence of mobile : ' + frequency # Open the airplane mode adbClient = AdbClient() adbClient.Start_Airplane() # Open the acs website homepage webcontrol = Webcontrol() webcontrol.Initial() webcontrol.Login() webcontrol.Clear_All_Data( config_element.get("system", "system_message_queue"), config_element.get("delete_file", "delete_all_message_queue_button"), "Delete Message successfully!") webcontrol.Parameter_List_Earfcn(earfcn) webcontrol.ACS_Initiate_Connection() webcontrol.HeNS_Request_Message_Earfcn( earfcn, heMS_SetParameterValues) webcontrol.Security_Logout() time.sleep(1) webcontrol.Exit() tc = Uiautomator_Control() tc.Switch_Home() # Reboot the cell rs232 = RS232_Putty() rs232.RS232_Connect_Putty() time.sleep(2) ssh = SSH() ssh.SSH_Command('./rsys/scripts/reboot-fap') time.sleep(150) rs232.RS232_Verify_Message_Putty('Time :') # Close the airplane mode adbClient.Stop_Airplane() # Make sure the cell is launched or not by *#0011# tc.Switch_Home() tc.Switch_Setting_Note4() tc.Switch_More_networks() tc.Switch_Mobile_networks() tc.Switch_Network_Operators() tc.Information_Alert() tc.Click_Device_Value1('note4') tc.Information_Alert() time.sleep(10) tc.Switch_Home() tc.CellMapper() tc.ServiceMode(frequency) earfcn = "38750" frequency = "38750" print '\nThe Cycle time is : ' + config_setting.get( "cycle_times", "times") + ' times.\nFinished.'
def iperf_NA(self): adbClient = AdbClient() adbClient.service_iperf_start() adbClient.iperf_client() adbClient.get_file() adbClient.Check_iStatus(local_file) adbClient.move_file("UP_TCP_")
def FTP_NA_Upload_S(self): android = Android() adbClient = AdbClient() print "NB Server & android Client (ftp upload)" adbClient.swiandroidh_FtpClient() android.mobile_device_connect() adbClient.download_over() android.ftp_creataccount() for i in range(0, int(times)): adbClient.ftplog_renew() android.ftp_connect() android.Verify_ftp_connect() android.folder_select("Upload") android.ftp_localfolder() adbClient.adb_event("123") adbClient.adb_event("123") android.folder_select("Upload") android.ftp_upload(filename) adbClient.Transfer_Status(filestart, fileend) adbClient.getfile_command() adbClient.Check_FileStatus() adbClient.adb_event("4") android.screen_shot_save("FTP_Upload") adbClient.FTP_Urate() adbClient.adb_event("66") adbClient.adb_event("66") adbClient.adb_event("111") adbClient.adb_event("111") adbClient.adb_event("111") android.mobile_device_disconnect()
def FTP_NA_Upload(self): android = Android() adbClient = AdbClient() times = "1" filename = "2.pdf" filestart = "/2.pdf" fileend = "62914560 bytes" print "NB Server & android Client (ftp upload)" adbClient.swiandroidh_FtpClient() adbClient.ftplog_renew() android.mobile_device_connect() adbClient.download_over() android.ftp_creataccount() android.ftp_connect() android.Verify_ftp_connect() android.folder_select("Upload") android.ftp_localfolder() adbClient.adb_event("123") adbClient.adb_event("123") android.folder_select("Upload") android.ftp_upload(filename) adbClient.Transfer_Status(filestart, fileend) adbClient.getfile_command() adbClient.Check_FileStatus() adbClient.adb_event("4") android.screen_shot_save("FTP_Upload") adbClient.FTP_Urate() android.mobile_device_disconnect()
def ciphering_type25(self): bandwidth = "25" TC.change_bandwidth(bandwidth) TC.change_ciphering() client.putconfigFile_femto() adbClient.Start_airplane() TC.restart_TeNB() time.sleep(50) adbClient.Stop_airplane() if __name__ == "__main__": # unittest.main() # HTMLTestRunner.main() TC = client_module() client = client() adbClient = AdbClient() android = Android() #===================unittest and HTMLTest ================= testunit = unittest.TestSuite() testunit.addTest(Test_plan("ipsec_256_256")) testunit.addTest(Test_plan("bandwidth_type100")) testunit.addTest(Test_plan("iperf_NA")) testunit.addTest(Test_plan("iperf_AN")) testunit.addTest(Test_plan("iperf_NA_U52")) testunit.addTest(Test_plan("iperf_AN_U160")) testunit.addTest(Test_plan("FTP_NA_Download")) testunit.addTest(Test_plan("FTP_NA_Upload")) # testunit.addTest(Test_plan("bandwidth_type75")) # testunit.addTest(Test_plan("iperf_NA"))
def test_PLMN(self): rs232 = RS232_Putty() rs232.RS232_Connect_Putty() android = Android() android.Check_Mobile_Note4() heMS_SetParameterValues = config_element.get( "location", "heMS_SetParameterValues") heNB_SetParameterValuesResponse = config_element.get( "location", "heNB_SetParameterValuesResponse") print 'PLMN\'s testcase...' for cycle_times in range( int(config_setting.get("cycle_times", "times"))): print 'The Cycle times : ' + str(cycle_times + 1) plmn = config_setting.get("setting", "PLMN") merge_plmn = plmn.split(" ")[0] + plmn.split(" ")[1] cellmapper_plmn = config.get("cellmapper_setting", "PLMN") # Click the PLMNID via PLMNList folder for runtime in range(int(config.get("plmn_setting", "times"))): status = config_setting.get("setting", "status") os.system("taskkill /F /IM iexplore.exe") print 'The Run Times : ' + str(runtime + 1) print 'PLMN of ACS : ' + merge_plmn + ' Frequence of mobile : ' + cellmapper_plmn # Open the airplane mode adbClient = AdbClient() adbClient.Start_Airplane() # Open the acs website homepage webcontrol = Webcontrol() webcontrol.Initial() webcontrol.Login() webcontrol.Clear_All_Data( config_element.get("system", "system_message_queue"), config_element.get("delete_file", "delete_all_message_queue_button"), "Delete Message successfully!") # Set the boolean to false webcontrol.Parameter_List_PLMN( config_element.get("PLMN", "enable_checkbox"), config_element.get("PLMN", "enable_value"), status) webcontrol.ACS_Initiate_Connection() webcontrol.HeNS_Request_Message_PLMN(status, heMS_SetParameterValues) webcontrol.HeNB_Response_Message( status, heNB_SetParameterValuesResponse) # Set the plmnid webcontrol.Parameter_List_PLMN( config_element.get("PLMN", "plmnid_checkbox"), config_element.get("PLMN", "plmnid_value"), merge_plmn) webcontrol.ACS_Initiate_Connection() webcontrol.HeNS_Request_Message_PLMN(merge_plmn, heMS_SetParameterValues) webcontrol.HeNB_Response_Message( status, heNB_SetParameterValuesResponse) # Set the boolean to true webcontrol.Parameter_List_PLMN( config_element.get("PLMN", "enable_checkbox"), config_element.get("PLMN", "enable_value"), str(int(status) + 1)) webcontrol.ACS_Initiate_Connection() webcontrol.HeNS_Request_Message_PLMN(str(int(status) + 1), heMS_SetParameterValues) webcontrol.HeNB_Response_Message( status, heNB_SetParameterValuesResponse) webcontrol.Security_Logout() time.sleep(1) webcontrol.Exit() tc = Uiautomator_Control() tc.Switch_Home() # Reboot the cell rs232 = RS232_Putty() rs232.RS232_Connect_Putty() time.sleep(2) ssh = SSH() ssh.SSH_Command('./rsys/scripts/reboot-fap') time.sleep(150) rs232.RS232_Verify_Message_Putty('Time :') # Close the airplane mode adbClient.Stop_Airplane() # Make sure the cell is launched or not by *#0011# tc.Switch_Home() tc.Switch_Setting_Note4() tc.Switch_More_networks() tc.Switch_Mobile_networks() tc.Switch_Network_Operators() tc.Information_Alert() tc.Click_Device_Value1('note4') tc.Information_Alert() time.sleep(10) tc.Switch_Home() tc.CellMapper() tc.ServiceMode_Verify_PLMN(cellmapper_plmn) merge_plmn = "12301" cellmapper_plmn = "123-01" print '\nThe Cycle time is : ' + config_setting.get( "cycle_times", "times") + ' times.\nFinished.'