資源簡(jiǎn)介
github地址: https://github.com/wuranxu/webTest
基于Python的webUI自動(dòng)化測(cè)試框架,支持多平臺(tái)~帶有自動(dòng)下載chrome驅(qū)動(dòng)功能

代碼片段和文件信息
import?os
import?platform
import?sys
class?baseConf(object):
????#?測(cè)試環(huán)境
????ENV?=?“dev“
????#?系統(tǒng)類型
????if?platform.system().lower()?==?“darwin“:
????????SYS?=?“mac“
????elif?platform.system().lower()?==?“windows“:
????????SYS?=?“win“
????else:
????????SYS?=?“l(fā)inux“
????#?MAC?os
????chrome_app?=?“/Applications/Google\?Chrome.app/Contents/MacOS/“?????#?mac?os?chrome安裝地址
????#?Win
????chrome_reg?=?r“SOFTWARE\Google\Chrome\BLBeacon“?????????????????????#?win?chrome注冊(cè)表地址
????#?用例配置
????soft_name?=?“百度網(wǎng)站“
????BROWSER?=?“Chrome“????#?啟動(dòng)瀏覽器
????url?=?“http://www.bing.com“??#?首頁(yè)
????system?=?platform.platform()??#?系統(tǒng)信息
????driver_url?=?“https://npm.taobao.org/mirrors/chromedriver/“
????TIMEOUT?=?12??#?元素等待超時(shí)時(shí)間
????exists?=?10????#?元素存在等待時(shí)間
????report_title?=?“baidu首頁(yè)自動(dòng)化測(cè)試報(bào)告“?????#?報(bào)告名字
????#?不執(zhí)行的測(cè)試集
????skip_suite?=?[]
????#?路徑配置
????#?CASE_NUM?=?None
????ROOT?=?os.path.dirname(os.path.abspath(__file__))
????report_path?=?os.path.join(ROOT?“Report“)????????#?報(bào)告路徑
????driver_dir?=?os.path.join(ROOT?“chromedriver“)???#?驅(qū)動(dòng)路徑
????pic_dir?=?os.path.join(ROOT?“ErrorPic“)??????????#?截圖路徑
????suite_name?=?“TestSuite“
????suite_dir?=?os.path.join(ROOT?suite_name)???????#?測(cè)試套件路徑
????report_mod?=?os.path.join(ROOT?“templates“?“report_template.html“)
????xmind?=?os.path.join(ROOT?“Xmind“)
????LOG_DIR?=?os.path.join(ROOT?“Log“)???????????????#?日志地址
????LOGGER?=?“webdriver_test“?????????????????????????#?日志名
????#?失敗重跑次數(shù)
????RETRY?=?0
????#?定位方法映射
????location?=?dict(css=“CSS_SELECTOR“?id=“ID“?name=“NAME“?xpath=“XPATH“
????????????????????link_text=“l(fā)ink_TEXT“?partial_link_text=“PARTIAL_link_TEXT“
????????????????????tag_name=“TAG_NAME“?class_name=“CLASS_NAME“)
????#?mongo數(shù)據(jù)庫(kù)配置信息
????MONGO_HOST?=?“192.168.199.9“?if?ENV?==?“dev“?else?“192.168.1.xx“
????MONGO_PORT?=?“27017“?if?ENV?==?“dev“?else?“27027“
????MONGO_USER?=?“yours“
????MONGO_PWD?=?“yours“
????#?mysql配置信息
????MYSQL_HOST?=?“xxx.xxx.xxx.xx“?if?ENV?==?“dev“?else?“192.168.1.xx“
????MYSQL_PORT?=?“3306“
????MYSQL_USER?=?“yours“
????MYSQL_PWD?=?“yours“
????#xmind頭文件配置
????xmind_head?=?[“from?TestSuite.base_case?import?baseCase“
??????????????????“from?Tools.decorator?import?screenshot“]
class?TiebaConf(baseConf):
????url?=?“http://tieba.baidu.com“??????#?測(cè)試百度貼吧配置
def?set_config():
????name?=?sys.argv[1]?if?len(sys.argv)?>=?2?else?“baseConf“
????cls_config?=?{“baseConf“:?baseConf?“SearchConf“:?TiebaConf}
????return?cls_config.get(name?baseConf)
class?Config(set_config()):
????pass
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-03-04?17:38??webTest\
?????文件???????10244??2018-03-04?17:34??webTest\.DS_Store
?????目錄???????????0??2018-03-13?17:00??__MACOSX\
?????目錄???????????0??2018-03-13?17:00??__MACOSX\webTest\
?????文件?????????120??2018-03-04?17:34??__MACOSX\webTest\._.DS_Store
?????目錄???????????0??2018-03-07?17:44??webTest\.git\
?????目錄???????????0??2018-03-04?16:05??webTest\.git\branches\
?????文件??????????14??2018-03-04?17:46??webTest\.git\COMMIT_EDITMSG
?????文件?????????308??2018-03-04?16:05??webTest\.git\config
?????文件??????????73??2018-03-04?16:05??webTest\.git\desc
?????文件??????????23??2018-03-04?16:05??webTest\.git\HEAD
?????目錄???????????0??2018-03-04?16:05??webTest\.git\hooks\
?????文件?????????478??2018-03-04?16:05??webTest\.git\hooks\applypatch-msg.sample
?????文件?????????896??2018-03-04?16:05??webTest\.git\hooks\commit-msg.sample
?????文件?????????189??2018-03-04?16:05??webTest\.git\hooks\post-update.sample
?????文件?????????424??2018-03-04?16:05??webTest\.git\hooks\pre-applypatch.sample
?????文件????????1642??2018-03-04?16:05??webTest\.git\hooks\pre-commit.sample
?????文件????????1348??2018-03-04?16:05??webTest\.git\hooks\pre-push.sample
?????文件????????4951??2018-03-04?16:05??webTest\.git\hooks\pre-reba
?????文件?????????544??2018-03-04?16:05??webTest\.git\hooks\pre-receive.sample
?????文件????????1239??2018-03-04?16:05??webTest\.git\hooks\prepare-commit-msg.sample
?????文件????????3610??2018-03-04?16:05??webTest\.git\hooks\update.sample
?????文件????????3610??2018-03-06?18:06??webTest\.git\index
?????目錄???????????0??2018-03-04?16:05??webTest\.git\info\
?????文件?????????240??2018-03-04?16:05??webTest\.git\info\exclude
?????目錄???????????0??2018-03-04?16:05??webTest\.git\logs\
?????文件?????????327??2018-03-04?17:46??webTest\.git\logs\HEAD
?????目錄???????????0??2018-03-04?16:05??webTest\.git\logs\refs\
?????目錄???????????0??2018-03-04?16:05??webTest\.git\logs\refs\heads\
?????文件?????????327??2018-03-04?17:46??webTest\.git\logs\refs\heads\master
?????目錄???????????0??2018-03-04?16:05??webTest\.git\logs\refs\remotes\
............此處省略222個(gè)文件信息
評(píng)論
共有 條評(píng)論