def test_buyUCDNTraffic_external(self): step.goto(URL.UCDN_Web_URL) ExternalTraffic = UCDN.GetExternalTraffic() UCDN.BuyTraffic(region=u"国外") step.addTS(5) ExternalTraffic = float(ExternalTraffic) + 1 expect = str(ExternalTraffic) + "0" UCDN.CheckExternalTraffic(expect)
def test_Panel_Monitor_Live(self): step.goto(URL.UCDN_Live_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnlive") UCDN1.ListSelect_Live(1) UCDN1.Panel_Monitor() UCDN1.Panel_Monitor_Live_PlayDomain(playdomain="hls") UCDN1.Panle_Monitor_more()
def test_buyUCDNTraffic_internal(self): step.goto(URL.UCDN_Web_URL) InternalTraffic = UCDN.GetInternalTraffic() UCDN.BuyTraffic() step.addTS(5) InternalTraffic = float(InternalTraffic) + 1 expect = str(InternalTraffic) + "0" UCDN.CheckInternalTraffic(expect)
def test_WebPage_Panel_Cache(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.Panel_Cache(1) #UCDN1.CacheModify(1) UCDN1.Panel_Cache_ContentRefreshHistory(tr=1,Type=u"检测时间") UCDN1.Panel_Cache_PrefetchFileHistory(1) UCDN1.ListSelect(1)
def test_SwitchChargeType(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN.ClickChargeType() UCDN.SelectChargeType_Bandwidth() UCDN.ClickCommit() step.addTS(5) UCDN.ClickChargeType() UCDN.SelectChargeType_Data() UCDN.ClickCommit()
def test_Live_CreateAndCheck(self): step.goto(URL.UCDN_Live_URL) step.addTS(5) UCDN4 = UCDN.UCDN(ProductType="ucdnlive") UCDN4.CreateUCDN_ClickButton() UCDN4.CreateUCDN_PublishDomain_Error() UCDN4.CreateUCDN_AccessPoint_Error() #UCDN4.CreateUCDN_RtmpPlayDomain_Error() UCDN4.CreateUCDN_HlsPlayDomain_Error() UCDN4.CreateUCDN_PublishDomain_HlsPlayDomain_Consistence()
def test_Stream_CreateAndCheck_Error(self): step.goto(URL.UCDN_Stream_URL) step.addTS(5) UCDN3 = UCDN.UCDN(ProductType="ucdnstream") UCDN3.CreateUCDN_ClickButton() UCDN3.CreateUCDN_InputDomain_Error() UCDN3.CreateUCDN_InputTesturl_Nohttp() UCDN3.CreateUCDN_InputTesturl_InputDomain_consistence() UCDN3.CreateUCDN_InputSourceip_Error() UCDN3.CreateUCDN_InputSourceDomain_Error() UCDN3.CreateUCDN_Cancel()
def test_WebPage_CreateAndCheck(self): # WebPage Created & Check step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN() UCDN1.CreateUCDN_ClickButton() UCDN1.CreateUCDN_InputDomain() UCDN1.CreateUCDN_SelectArea() print UCDN1.Area UCDN1.CreateUCDN_SelectArea(u"国外") print UCDN1.Area UCDN1.CreateUCDN_SelectArea(u"全部") UCDN1.CreateUCDN_InputTesturl() UCDN1.CreateUCDN_InputSourceip() UCDN1.CreateUCDN_ClickNext() UCDN1.CreateUCDN_CheckLayer() UCDN1.CreateUCDN_ClickCommit() # step.addTS(5) # UCDN1.CreateUCDN() # step.goto(URL.UCDN_Download_URL) # step.addTS(5) # UCDN2 = UCDN.UCDN(ProductType="ucdndownload") # UCDN2.CreateUCDN_ClickButton() # UCDN2.CreateUCDN_InputDomain() # UCDN2.CreateUCDN_InputTesturl() # UCDN2.CreateUCDN_InputSourceip() # UCDN2.CreateUCDN_ClickNext() # UCDN2.CreateUCDN_ClickCommit() # # step.goto(URL.UCDN_Stream_URL) # step.addTS(5) # UCDN3 = UCDN.UCDN(ProductType="ucdnstream") # UCDN3.CreateUCDN_ClickButton() # UCDN3.CreateUCDN_InputDomain() # UCDN3.CreateUCDN_InputTesturl() # UCDN3.CreateUCDN_InputSourceip() # UCDN3.CreateUCDN_ClickNext() # UCDN3.CreateUCDN_ClickCommit() # # step.goto(URL.UCDN_Live_URL) # step.addTS(5) # UCDN4 = UCDN.UCDN(ProductType="ucdnlive") # UCDN4.CreateUCDN_ClickButton() print UCDN1.ProductType print UCDN1.Domain print UCDN1.Area print UCDN1.Testurl print UCDN1.Sourceip
def test_WebPage_CreateAndCheck_Error(self): # WebPage Created & Check step.goto(URL.UCDN_Web_URL) step.addTS(10) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.CreateUCDN_ClickButton() UCDN1.CreateUCDN_InputDomain_Error() UCDN1.CreateUCDN_InputTesturl_Nohttp() UCDN1.CreateUCDN_InputTesturl_InputDomain_consistence() UCDN1.CreateUCDN_InputSourceip_Error() UCDN1.CreateUCDN_InputSourceDomain_Error() UCDN1.CreateUCDN_Cancel()
def test_Live_CreateAndCheck(self): step.goto(URL.UCDN_Live_URL) step.addTS(5) UCDN4 = UCDN.UCDN(ProductType="ucdnlive") UCDN4.CreateUCDN_ClickButton() UCDN4.CreateUCDN_PublishDomain() UCDN4.CreateUCDN_AccessPoint() UCDN4.CreateUCDN_RtmpPlayDomain() UCDN4.CreateUCDN_HlsPlayDomain() UCDN4.CreateUCDN_ClickNext() UCDN4.CreateUCDN_ClickCommit() step.addTS(5)
def test_Download_CreateAndCheck_SourceDomain(self): step.goto(URL.UCDN_Download_URL) step.addTS(5) UCDN2 = UCDN.UCDN(ProductType="ucdndownload") UCDN2.CreateUCDN_ClickButton() UCDN2.CreateUCDN_InputDomain() UCDN2.CreateUCDN_InputTesturl() UCDN2.CreateUCDN_InputSource(source=u"源站域名") UCDN2.CreateUCDN_ClickNext() UCDN2.CreateUCDN_ClickCommit() step.addTS(5) UCDN2.V3_List_UCDN_CheckData_td(1, 3) UCDN2.V3_List_UCDN_CheckData_td(1, 5) UCDN2.V3_List_UCDN_CheckData_td(1, 6)
def test_Stream_CreateAndCheck(self): step.goto(URL.UCDN_Stream_URL) step.addTS(5) UCDN3 = UCDN.UCDN(ProductType="ucdnstream") UCDN3.CreateUCDN_ClickButton() UCDN3.CreateUCDN_InputDomain() UCDN3.CreateUCDN_InputTesturl() UCDN3.CreateUCDN_InputSource() UCDN3.CreateUCDN_ClickNext() UCDN3.CreateUCDN_ClickCommit() step.addTS(5) UCDN3.V3_List_UCDN_CheckData_td(1, 3) UCDN3.V3_List_UCDN_CheckData_td(1, 5) UCDN3.V3_List_UCDN_CheckData_td(1, 6)
def test_WebPage_CreateAndCheck(self): # WebPage Created & Check step.goto(URL.UCDN_Web_URL) step.addTS(10) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.CreateUCDN_ClickButton() UCDN1.CreateUCDN_InputDomain() UCDN1.CreateUCDN_SelectArea() UCDN1.CreateUCDN_InputTesturl() UCDN1.CreateUCDN_InputSource(source=u"源站IP") UCDN1.CreateUCDN_ClickNext() UCDN1.CreateUCDN_CheckLayer() UCDN1.CreateUCDN_ClickCommit() step.addTS(5) UCDN1.V3_List_UCDN_CheckData_td(1, 3) UCDN1.V3_List_UCDN_CheckData_td(1, 5) UCDN1.V3_List_UCDN_CheckData_td(1, 6)
def test_WebPage_Monitor(self): step.goto(URL.UCDN_Web_URL) step.addTS(8) tr=3 UCDN1 = UCDN.UCDN(ProductType="ucdnweb") self.Domain=UCDN1.V3_List_UCDN_GetData(tr, 3) UCDN1.ListSelect(tr) UCDN1.Panel_Monitor(tr) UCDN1.Panel_Monitor_Detail(tr) step.addTS(8) UCDN1.SelectUCDNType(u"网页加速") self.Domain_Report=UCDN1.UCDNTypeChecklist(tr) if self.Domain==self.Domain_Report: step.addLog("Domains are filtered correctly!") else: raise step.caseVarError() UCDN1.BandwidthReport_GraphDataStatisticSwitch() UCDN1.UCDNname_Filter(self.Domain) step.addTS(2) self.Domain_Report1=UCDN1.UCDNTypeChecklist(1) if self.Domain==self.Domain_Report1: step.addLog("Domain is filtered correctly!") else: raise step.caseVarError()
def test_WebPage_RefreshContent(self): step.goto(URL.UCDN_Web_URL) step.addTS(10) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.RefreshContent(2)
def test_WebPage_Panel_Cache(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.ListSelect_Live(1) UCDN1.Panel_OperationHistory()
def test_init(self): # test_init step.addLog_step("Init") step.goto("http://www.baidu.com") step.addTS()
def test_Stream_Delete(self): step.goto(URL.UCDN_Stream_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="stream") UCDN1.DeleteUCDN(1)
def test_WebPage_PrefetchFile(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.ListSelect(1) UCDN1.PrefetchFile(2)
def test_Download_PrefetchFile(self): step.goto(URL.UCDN_Download_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdndownload") UCDN1.ListSelect(1) UCDN1.PrefetchFile(2)
def test_WebPage_Panel_Domain(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.Panel_Domain(1)
def test_Panel_Download_Live(self): step.goto(URL.UCDN_Live_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnlive") UCDN1.ListSelect_Live(1) UCDN1.Panel_Monitor_Live_Download()
def test_Download_Delete(self): step.goto(URL.UCDN_Download_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="download") UCDN1.DeleteUCDN(1)
import unittest,os from UTest_frameV1 import step # TestCase Data CaseName = os.path.basename(__file__) class Test(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.accept_next_alert = True step.CaseStart(CaseName) # Test Steps Here def test_baidu_homepage1(self): # Link_news check Link_news = step.link('//a[@name="tj_trnews"]',"http://news.baidu.com/") Link_news.checkURL() step.TestEnd() def tearDown(self): step.CaseEnd() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": step.goto("http://www.baidu.com") step.addTS() unittest.main()
def test_Download_RefreshContent(self): step.goto(URL.UCDN_Download_URL) step.addTS(3) UCDN1 = UCDN.UCDN(ProductType="ucdndownload") UCDN1.RefreshContent(2)
def test_WebPage_UpdateStatus_Single(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnweb") UCDN1.UpdateStatus_Single(2) UCDN1.UpdateStatus_ClickCommit()
def test_Panel_OperationHistory_Live(self): step.goto(URL.UCDN_Live_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="ucdnlive") UCDN1.ListSelect_Live(1) UCDN1.Panel_OperationHistory()
def test_Download_UpdateStatus_Mutiple(self): step.goto(URL.UCDN_Download_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="download") UCDN1.UpdateStatus_Mutiple() UCDN1.UpdateStatus_ClickCommit()
def test_Stream_UpdateStatus_Single(self): step.goto(URL.UCDN_Stream_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="download") UCDN1.UpdateStatus_Single(1) UCDN1.UpdateStatus_ClickCommit()
def test_WebPage_Delete(self): step.goto(URL.UCDN_Web_URL) step.addTS(5) UCDN1 = UCDN.UCDN(ProductType="WebPage") UCDN1.DeleteUCDN(1)