Example #1
0
 def web_page_districthotellist(self):
     try:
         error = 0
         url = "http://10.2.25.24:8180/appautocomplete/search?source=offline&action=autocomplete&keyword=keyword_value"
         browser = webdriver.Firefox()
         for keyword in loadkeyword.load_keyword_from_AppTestCase():
             keyword = str(keyword)
             keyword_quote = urllib.quote(keyword)
             urlnew = url.replace("keyword_value",keyword_quote)
             content = http.getresponse_url_python(urlnew)
             for m in range(len(content["data"])):
                     a = http.get_key_vlue(urlnew,m,"type")
                     if a == "districthotellist":
                         b = content["data"][m]["url"]
                         c = content["data"][m]["word"]
                         d = content["data"][m]["districtname"]
                         browser.get(b) # Load page
                         time.sleep(5)
                         if d+"酒店" in browser.title:
                             infovalue = "districthotellist测试,"+"测试过的关键字为"+keyword+"结果正确"
                             log.info(infovalue)
                         else:
                             error = error+1
                             infovalue = "districthotellist测试,"+"测试过的关键字为:"+keyword+"结果错误,"+"word="+c[:-3]+"网页title="+browser.title
                             log.info(infovalue)
                             print "districthotellist测试错误",keyword,c,d,browser.title
     except Exception,e:
         log.error(e)
Example #2
0
 def nearby_hotle_price_no_null_Test(self):
     error = 0
     url = ['http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=121.35801673&lat=31.22016018&districtid=2&type=fortest',
             'http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=120.545916&lat=31.315913&districtid=100066&type=fortest',
             'http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=120.984205&lat=31.393074&districtid=77&type=fortest',
             'http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=114.055626&lat=22.316061&districtid=38&type=fortest',
             'http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=121.090235&lat=24.17594&districtid=100076&type=fortest',
             'http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=2.294481&lat=48.85837&districtid=100024&type=fortest',
             'http://10.8.91.244:8180/appautocomplete/search?keyword=%e9%99%84%e8%bf%91&action=autocomplete&source=globalapp65&lon=2.294481&lat=48.85837&districtid=308&type=fortest']
     for n in range(len(url)):
         content = http.getresponse_url_python(url[n])
         for m in range(len(content["data"])):
             try:
                 a = http.get_key_vlue(url[n],m,"price")
                 if a == "null":
                     error = error+1
                     print url[n]
             except Exception:
                 1 == 1
     assert error == 0