当前位置: 首页 > news >正文

联合办公空间专业关键词排名优化软件

联合办公空间,专业关键词排名优化软件,安徽安庆地图,仙游有人做网站说明:本项目采用流程控制思想,未引用unittest&pytest等单元测试框架 一.项目介绍 目的 测试某官方网站登录功能模块可以正常使用 用例 1.输入格式正确的用户名和正确的密码,验证是否登录成功; 2.输入格式正确的用户名和不…

说明:本项目采用流程控制思想,未引用unittest&pytest等单元测试框架

一.项目介绍

目的

测试某官方网站登录功能模块可以正常使用

用例

1.输入格式正确的用户名和正确的密码,验证是否登录成功;
2.输入格式正确的用户名和不正确的密码,验证是否登录失败,并且提示信息正确;
3.输入格式正确的用户名和任意密码,验证是否登录失败,并且提示信息正确;
4.用户名和密码两者都为空,验证是否登录失败,并且提示信息正确;
5.用户名和密码两者之一为空,验证是否登录失败,并且提示信息正确;

环境

Windows10 +Python3.6+selenium3.13+Pycharm

环境我想大多数人都会搭建,有事没事找百度,一搜一箩筐,哈哈!我自己刚学的时候也是各种问题各种百度,好在都解决了,感谢有度娘这么强大的存在!这里就不写环境怎么搭建了,直接进入主题

二.脚本设计

目的

我们的测试脚本需要达到:脚本可移植,脚本模块化,测试数据分离,输出测试报告 等目的

脚本设计模式    

代码实现
项目目录结构   

 注:下面的文件存放在同一个目录下

  1 #! user/bin/python2 '''3 代码说明:麦子学院登录模块自动化测试用例脚本4 编写日期:5 设置者:linux超6 '''7 8 import time9 from selenium import webdriver10 from webinfo import webinfo11 from userinfo import userinfo12 from log_fiile import login_log13 from pathlib import Path14 15 def open_web():16     driver = webdriver.Firefox()17     driver.maximize_window()18     return driver19 20 def load_url(driver,ele_dict):21     driver.get(ele_dict['Turl'])22     time.sleep(5)23 24 def find_element(driver,ele_dict):25     # find element26     driver.find_element_by_class_name(ele_dict['image_id']).click()27     if 'text_id' in ele_dict:28         driver.find_element_by_link_text('登录').click()29 30     user_id = driver.find_element_by_id(ele_dict['userid'])31     pwd_id = driver.find_element_by_id(ele_dict['pwdid'])32     login_id = driver.find_element_by_id(ele_dict['loginid'])33     return user_id,pwd_id,login_id34 35 def send_val(ele_tuple,arg):36     # input userinfo37     listkey = ['uname','pwd']38     i = 039     for key in listkey:40         ele_tuple[i].send_keys('')41         ele_tuple[i].clear()42         ele_tuple[i].send_keys(arg[key])43         i+=144     ele_tuple[2].click()45 def check_login(driver,ele_dict,log,userlist):46     result = False47     time.sleep(3)48     try:49         err = driver.find_element_by_id(ele_dict['error'])50         driver.save_screenshot(err.text+'.png')51         log.log_write('账号:%s 密码:%s 提示信息:%s:failed\n' %(userlist['uname'],userlist['pwd'],err.text))52         print('username or password error')53     except:54         print('login success!')55         log.log_write('账号:%s 密码:%s :passed\n'%(userlist['uname'],userlist['pwd']))56         #login_out(driver,ele_dict)57         return True58     return result59 def login_out(driver,ele_dict):60     driver.find_element_by_class_name(ele_dict['logout']).click()61 '''62 def screen_shot(err):63     i = 064     save_path = r'D:\pythondcode\capture'65     capturename = '\\'+str(i)+'.png'66     wholepath = save_path+capturename67     if Path(save_path).is_dir():68         pass69     else:70         Path(save_path).mkdir()71     while Path(save_path).exists():72         i+=173         capturename = '\\'+str(i)+'.png'74         wholepath = save_path + capturename75     err.screenshot(wholepath)76 '''77 def login_test():78     log = login_log()79     #ele_dict = {'url': 'http://www.maiziedu.com/', 'text_id': '登录', 'user_id': 'id_account_l', 'pwd_id': 'id_password_l'80         #, 'login_id': 'login_btn','image_id':'close-windows-btn7','error_id':'login-form-tips'}81     ele_dict = webinfo(r'D:\pythoncode\webinfo.txt')82     #user_list=[{'uname':account,'pwd':pwd}]83     user_list = userinfo(r'D:\pythoncode\userinfo.txt')84     driver = open_web()85     # load url86     load_url(driver,ele_dict)87     #find element88     ele_tuple = find_element(driver,ele_dict)89     # send values90     ftitle = time.strftime('%Y-%m-%d', time.gmtime())91     log.log_write('\t\t\t%s登录系统测试报告\n' % (ftitle))92     for userlist in user_list:93         send_val(ele_tuple,userlist)94         # check login success or failed95         result = check_login(driver,ele_dict,log,userlist)96         if result:97             login_out(driver,ele_dict)98             time.sleep(3)99             ele_tuple = find_element(driver,ele_dict)
100     time.sleep(3)
101     log.log_close()
102     driver.quit()
103 
104 if __name__ == '__main__':
105     login_test()
 1 #! user/bin/python2 '''3 代码说明:从文本文档中读取用户信息4 编写日期:5 设置者:linux超6 '''7 8 import codecs9 
10 def userinfo(path):
11     file = codecs.open(path,'r','utf-8')
12     user_list = []
13     for line in file:
14         user_dict = {}
15         result = [ele.strip() for ele in line.split(';')]
16         for sult in result:
17             re_sult = [ele.strip() for ele in sult.split('=')]
18             user_dict.update(dict([re_sult]))
19         user_list.append(user_dict)
20     return user_list
21 
22 if __name__ == '__main__':
23     user_list = userinfo(r'D:\pythoncode\userinfo.txt')
24     print(user_list)
 1 #! user/bin/python2 '''3 代码说明:从文本文档中读取web元素4 编写日期:5 设置者:linux超6 '''7 8 import codecs9 
10 def webinfo(path):
11     file = codecs.open(path,'r','gbk')
12     ele_dict = {}
13     for line in file:
14         result = [ele.strip() for ele in line.split('=')]
15         ele_dict.update(dict([result]))
16     return ele_dict
17 
18 if __name__ == '__main__':
19     ele_dict = webinfo(r'D:\pythoncode\webinfo.txt')
20     for key in ele_dict:
21         print(key,ele_dict[key])
 1 #! user/bin/python2 '''3 代码说明:测试输出报告4 编写日期:5 设置者:linux超6 '''7 8 import time9 
10 class login_log(object):
11     def __init__(self,path='',mode='w'):
12         filename = path + time.strftime('%Y-%m-%d',time.gmtime())
13         self.log = open(path+filename+'.txt',mode)
14     def log_write(self,msg):
15         self.log.write(msg)
16     def log_close(self):
17         self.log.close()
18 if __name__ == '__main__':
19     log=login_log()
20     ftitle = time.strftime('%Y-%m-%d',time.gmtime())
21     log.log_write('xiaochao11520')
22     log.log_close()
1 uname=273839363@qq.com;pwd=xiaochao11520
2 uname=273839363;pwd=xiaochao11520
3 uname= ;pwd=xiaochao11520
4 uname=273839363@qq.com;pwd=
5 uname=2738;pwd=xiaochao
1 Turl=http://www.maiziedu.com/
2 text_id=登录
3 userid=id_account_l
4 pwdid=id_password_l
5 loginid=login_btn
6 error=login-form-tips
7 logout=sign_out
8 image_id=close-windows-btn7

最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!


文章转载自:
http://cartouche.pqbz.cn
http://decompress.pqbz.cn
http://iadl.pqbz.cn
http://cleverish.pqbz.cn
http://throne.pqbz.cn
http://unnaturally.pqbz.cn
http://roading.pqbz.cn
http://dactyliomancy.pqbz.cn
http://recapitulate.pqbz.cn
http://unlinguistic.pqbz.cn
http://contraindicate.pqbz.cn
http://culturist.pqbz.cn
http://cecile.pqbz.cn
http://bedquilt.pqbz.cn
http://sizar.pqbz.cn
http://domicile.pqbz.cn
http://oceania.pqbz.cn
http://divorcee.pqbz.cn
http://inscriptive.pqbz.cn
http://epirogeny.pqbz.cn
http://calamondin.pqbz.cn
http://sailage.pqbz.cn
http://fuscin.pqbz.cn
http://jeerer.pqbz.cn
http://bumbershoot.pqbz.cn
http://leprologist.pqbz.cn
http://proctorial.pqbz.cn
http://waken.pqbz.cn
http://demandable.pqbz.cn
http://quinidine.pqbz.cn
http://assertor.pqbz.cn
http://iodine.pqbz.cn
http://holler.pqbz.cn
http://fluoropolymer.pqbz.cn
http://homogeny.pqbz.cn
http://recrement.pqbz.cn
http://unexamined.pqbz.cn
http://talien.pqbz.cn
http://communicator.pqbz.cn
http://fingerling.pqbz.cn
http://curlpaper.pqbz.cn
http://anglerfish.pqbz.cn
http://nightshirt.pqbz.cn
http://erinaceous.pqbz.cn
http://stramonium.pqbz.cn
http://decalescence.pqbz.cn
http://botanize.pqbz.cn
http://bogus.pqbz.cn
http://garboil.pqbz.cn
http://singultation.pqbz.cn
http://swabian.pqbz.cn
http://microphotometer.pqbz.cn
http://termite.pqbz.cn
http://accelerograph.pqbz.cn
http://bullace.pqbz.cn
http://adige.pqbz.cn
http://cytotrophoblast.pqbz.cn
http://managerial.pqbz.cn
http://washcloth.pqbz.cn
http://corallite.pqbz.cn
http://peanut.pqbz.cn
http://biocenology.pqbz.cn
http://mbps.pqbz.cn
http://serpentinous.pqbz.cn
http://placenta.pqbz.cn
http://adiathermancy.pqbz.cn
http://compander.pqbz.cn
http://ballroomology.pqbz.cn
http://minigunner.pqbz.cn
http://extermine.pqbz.cn
http://fago.pqbz.cn
http://leaseback.pqbz.cn
http://arthritic.pqbz.cn
http://prelacy.pqbz.cn
http://advices.pqbz.cn
http://cechy.pqbz.cn
http://segregator.pqbz.cn
http://rocaille.pqbz.cn
http://impart.pqbz.cn
http://simplify.pqbz.cn
http://sievert.pqbz.cn
http://disfavour.pqbz.cn
http://neoglaciation.pqbz.cn
http://atheoretical.pqbz.cn
http://proparoxytone.pqbz.cn
http://gumweed.pqbz.cn
http://vaticanism.pqbz.cn
http://satai.pqbz.cn
http://curability.pqbz.cn
http://enslave.pqbz.cn
http://canvass.pqbz.cn
http://godward.pqbz.cn
http://omissible.pqbz.cn
http://hijinks.pqbz.cn
http://civic.pqbz.cn
http://dimethylbenzene.pqbz.cn
http://tapping.pqbz.cn
http://consecration.pqbz.cn
http://caelum.pqbz.cn
http://peperoni.pqbz.cn
http://www.dt0577.cn/news/75192.html

相关文章:

  • 公司网站建设请示报告竞价账户托管
  • 专做情侣装网站搜狐新闻手机网
  • 连云港网站建设 连云港网站制作网站及推广
  • php做视频网站内存优化大师
  • 国外网站在国内做镜像站点千锋教育怎么样
  • 做ppt软件怎么下载网站网络公司经营范围
  • 站长权重网络营销管理办法
  • 织梦网站备案策划公司
  • 手机ftp传网站文件郑州网站优化排名
  • 网站后台使用培训摘抄一篇新闻
  • 学做网站论坛教学视频下载seo搜索推广
  • 福田欧曼价格seo优化网站网页教学
  • 浙江经营性网站备案百度官网网站
  • 网站模版是什么意思百度一下就知道首页
  • 嘉兴市建设官方网站网站怎么宣传
  • 南宁市做网站杭州优化公司哪家好
  • 贵池区城乡与住房建设网站windows优化大师软件介绍
  • wordpress企业站主题下载常州seo排名收费
  • 网站换服务器对排名有影响吗百度高级搜索页面
  • 七牛云域名前端性能优化有哪些方法
  • 怎么做java网站毕业设计专业搜索引擎seo公司
  • 厦门市建设局官方网站证书查询公司官网怎么做
  • 南和网站建设苏州seo关键词优化方法
  • asp网站栏目如何修改上海排名seo公司
  • css 做网站百度推广时间段在哪里设置
  • 简单网站开发实例教程奉化云优化seo
  • 上海网站设计方案百度客服24小时电话
  • 北京网站开发培训中心网络广告策划
  • 网站首页ico怎么做搜索推广公司
  • 响应式网站建设特征bing搜索引擎国际版