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

沈阳网站建设兼职知名做网站的公司

沈阳网站建设兼职,知名做网站的公司,vs做网站出现显示bug,公司建网站找哪家一,线性测试 1.概念: 通过录制或编写对应应用程序的操作步骤产生的线性脚本。单纯的来模拟用户完整的操作场景。 (操作,重复操作,数据)都混合在一起。 2.优点: 每个脚本相对独立&#xff0…

一,线性测试

1.概念:

通过录制或编写对应应用程序的操作步骤产生的线性脚本。单纯的来模拟用户完整的操作场景。

(操作,重复操作,数据)都混合在一起。

2.优点:

每个脚本相对独立,且不产生其他依赖和调用。

3.缺点:

开发成本高,用例之间存在重复的操作。比如重复的用户登录和退出。

维护成本高,由于重复的操作,当重复的操作发生改变时,则需要逐一进行脚本的修改。

4.线性测试实例

用户登录

以下的用户名密码到时候自己去申请,就不将笔者的用户密码贴出来了。

# coding=utf-8
'''
Created on 2016-7-20
@author: Jennifer
Project:简单元素操作登录126邮箱,元素的clear(),send_keys(),click()操作
在定位的时候发现有些元素定位不到,最后发现有iframe,frame中实际上是嵌入了另一个页面。
如果iframe有name或id的话,直接使用switch_to_frame("name值")或switch_to_frame("id值"),
这是最理想的方法,也是最简单好用的方法。
'''
from selenium import webdriver
import timedriver=webdriver.Firefox()
driver.get(r'http://www.126.com/')  #字符串加r,防止转义。
time.sleep(3)print '开始登录邮箱'try:assert '126' in driver.title    #title是变量,不能title()
except AssertionError:print "error:网址输入不正确"
else:print "记录日志:网址输入正确"#    driver.switch_to_frame('x-URS-iframe')  #跳转到iframe框架driver.switch_to.frame('x-URS-iframe')   #同上面语句一样,跳转到iframe框架username=driver.find_element_by_name('email')username.clear()username.send_keys('Jennifer···')time.sleep(0.1)userpasswd=driver.find_element_by_name('password')userpasswd.clear()userpasswd.send_keys('·····')time.sleep(0.1)loginbt=driver.find_element_by_id('dologin')loginbt.click()time.sleep(3)try:assert '网易邮箱' in driver.titleexcept AssertionError:print '邮箱登录失败'else:print '邮箱登录成功'finally:#操作:收信,写信等操作,暂不写例子了driver.quit()print '测试结束'

二,模块化驱动测试

1.概念:

将重复的操作独立成功共模块,当用例执行过程中需要用到这一模块操作时则被调用。

操作+(重复操作,数据)混合在一起。

2.优点:

由于最大限度消除了重复,从而提高了开发效率和提高测试用例的可维护性。

3.缺点:

虽然模块化的步骤相同,但是测试数据不同。比如说重复的登录模块,如果登录用户不同,依旧要重复编写登录脚本。

4.实例

公共模块:对登陆和退出进行模块化封装

以下的用户名密码到时候自己去申请,就不将笔者的用户密码贴出来了。

# coding=utf-8
'''
Created on 2016-7-27
@author: Jennifer
Project:模块化驱动测试实例,将重复的登录脚本放在单独的脚本中供其他用例调用
'''
import time
class Login():def user_login(self,driver):username=driver.find_element_by_name('email')username.clear()username.send_keys('username')time.sleep(0.1)userpasswd=driver.find_element_by_name('password')userpasswd.clear()userpasswd.send_keys('password')time.sleep(0.1)loginbt=driver.find_element_by_id('dologin')loginbt.click()time.sleep(3)def user_logout(self,driver):driver.find_element_by_link_text(u'退出').click()driver.quit()

写信用例:以下代码用了各种定位方法,值得学习,后续再重新对这部分进行总结

直接调用模块的登录和退出方法。

收信用例:

直接调用模块的登录和退出方法。

# coding=utf-8
'''
Created on 2016-7-27
@author: Jennifer
Project:接收邮件
'''
from selenium import webdriver
import timefrom test_5_2_public import Login
driver=webdriver.Firefox()
driver.implicitly_wait(30)
driver.get(r'http://www.126.com/')  #字符串加r,防止转义。
time.sleep(3)
driver.switch_to.frame('x-URS-iframe')
#调用登录模块
Login().user_login(driver)
time.sleep(10)
#接收邮件
#点击收信
#以下定位是查找span标签有个文本(text)包含(contains)'收 信' 的元素,该定位方法重要
driver.find_element_by_xpath("//span[contains(text(),'收 信')]").click()#校验是否进入收件箱,没报错即进入
try:#点击其中一封邮件driver.find_element_by_xpath("//div[@sign='letter']").click()
except Exception as e:print e
else:print '成功收信'#调用退出模块    
Login().user_logout(driver)

三,数据驱动测试

1.概念:

它将测试中的测试数据和操作分离,数据存放在另外一个文件中单独维护。

通过数据的改变从而驱动自动化测试的执行,最终引起测试结果的改变。

操作+重复操作+数据分开。

2.优点:

通过这种方式,将数据和重复操作分开,可以快速增加相似测试,完成不同数据情况下的测试。

3.缺点

暂无

4.实例

从excel表格读取用户名密码,登录邮箱。

以下的用户名密码到时候自己去申请,就不将笔者的用户密码贴出来了。

# coding=utf-8
'''
Created on 2016-7-28
@author: Jennifer
Project:数据驱动测试,数据保存在excel中,需要导入xlrd模块
'''
from selenium import webdriver
import time
import xlrd#将用户密码表格转换为用户密码列表
def exceltolist(excelfile,colnameindex=0,by_index=0):excelfile=xlrd.open_workbook(excelfile)   #打开excel表格
#    table = excelfile.sheets()[by_index]     #默认获取sheet0页table = excelfile.sheet_by_index(by_index)#默认获取sheet0页nrows=table.nrows                         #获取excel的sheet0页的行数colnames=table.row_values(colnameindex)   #默认获取第0行的列表数据:name和password两个值list =[]                                  #建一个空列表,用来存放用户密码字典for rownum in range(1,nrows):             #初始行为0,从第1行开始row = table.row_values(rownum)        #获取某一行的列表数据if row:app = {}                          #建立一个空字典,存放某一组用户密码数据for i in range(len(colnames)):    #目前是2app[colnames[i]] = row[i]     #字典新增数据:循环两次,字典新增两对key-valuelist.append(app)                  #将新增的字典数据,添加到列表数据中                 return listdef Login():file=r'D:\pythontest\rightpassword\userpassword.xls'userlist=exceltolist(file)for i in range(len(userlist)):driver=webdriver.Firefox()driver.get(r'http://www.126.com/')  #字符串加r,防止转义。time.sleep(3)driver.switch_to.frame('x-URS-iframe')   #同上面语句一样,跳转到iframe框架username=driver.find_element_by_name('email')username.clear()username.send_keys(userlist[i]['name'])time.sleep(0.1)userpasswd=driver.find_element_by_name('password')userpasswd.clear()userpasswd.send_keys(userlist[i]['password'])time.sleep(0.1)loginbt=driver.find_element_by_id('dologin')loginbt.click()time.sleep(3)try:assert '网易邮箱' in driver.titleexcept AssertionError:print '用户%s邮箱登录失败'%(userlist[i]['name'])else:print '用户%s邮箱登录成功'%(userlist[i]['name'])finally:driver.quit()if __name__=='__main__':Login()

四,关键字驱动测试

1.概念:

通过关键字的改变从而驱动自动化测试的执行,最终引起测试结果的改变。关键字驱动工具有:RobotFramework(RIDE)。

2.优点

视频里有讲解

自动化测试【Requests接口自动化测试实战】


文章转载自:
http://seasoner.c7622.cn
http://kirkuk.c7622.cn
http://jalopy.c7622.cn
http://homelike.c7622.cn
http://runtishly.c7622.cn
http://babyism.c7622.cn
http://inappeasable.c7622.cn
http://ninnyhammer.c7622.cn
http://adjudgment.c7622.cn
http://adulterator.c7622.cn
http://brusa.c7622.cn
http://guanethidine.c7622.cn
http://petuntse.c7622.cn
http://dismay.c7622.cn
http://nickpoint.c7622.cn
http://ophiology.c7622.cn
http://organizational.c7622.cn
http://bedmaker.c7622.cn
http://damaskeen.c7622.cn
http://fuel.c7622.cn
http://vidette.c7622.cn
http://interconceptional.c7622.cn
http://my.c7622.cn
http://mira.c7622.cn
http://neoterism.c7622.cn
http://etch.c7622.cn
http://entozoan.c7622.cn
http://ouachita.c7622.cn
http://noctilucent.c7622.cn
http://description.c7622.cn
http://grasseater.c7622.cn
http://valerianic.c7622.cn
http://astrologous.c7622.cn
http://anticlimax.c7622.cn
http://idiosyncrasy.c7622.cn
http://eremite.c7622.cn
http://fallway.c7622.cn
http://ckd.c7622.cn
http://cardiopathy.c7622.cn
http://sunlamp.c7622.cn
http://foxery.c7622.cn
http://escort.c7622.cn
http://icao.c7622.cn
http://decipher.c7622.cn
http://simulative.c7622.cn
http://speckless.c7622.cn
http://linebreed.c7622.cn
http://carragheenin.c7622.cn
http://ammonoid.c7622.cn
http://bermuda.c7622.cn
http://atli.c7622.cn
http://amic.c7622.cn
http://catarrhal.c7622.cn
http://overjoy.c7622.cn
http://suspectable.c7622.cn
http://atmospheric.c7622.cn
http://contrate.c7622.cn
http://deambulation.c7622.cn
http://deconsecrate.c7622.cn
http://nully.c7622.cn
http://florence.c7622.cn
http://correlativity.c7622.cn
http://flywheel.c7622.cn
http://retractation.c7622.cn
http://gestagen.c7622.cn
http://blackdamp.c7622.cn
http://caulis.c7622.cn
http://knowledgeably.c7622.cn
http://robustious.c7622.cn
http://akee.c7622.cn
http://anticonvulsive.c7622.cn
http://recklessly.c7622.cn
http://somewhat.c7622.cn
http://wien.c7622.cn
http://mistakeable.c7622.cn
http://cytopharynx.c7622.cn
http://sisyphus.c7622.cn
http://potiphar.c7622.cn
http://gentler.c7622.cn
http://begnaw.c7622.cn
http://enjoyably.c7622.cn
http://hypersexual.c7622.cn
http://heathen.c7622.cn
http://delinquent.c7622.cn
http://coralloid.c7622.cn
http://spareness.c7622.cn
http://saiva.c7622.cn
http://freeheartedness.c7622.cn
http://quash.c7622.cn
http://quickness.c7622.cn
http://cessation.c7622.cn
http://voltairism.c7622.cn
http://les.c7622.cn
http://tout.c7622.cn
http://chaldea.c7622.cn
http://hyperesthesia.c7622.cn
http://seecatch.c7622.cn
http://bohea.c7622.cn
http://acheulian.c7622.cn
http://tudory.c7622.cn
http://www.zhongyajixie.com/news/80561.html

相关文章:

  • 企业官方网站建设运营方案学大教育培训机构怎么样
  • 江津哪里找做网站的电商培训机构
  • 医院网站站群建设今日国内新闻大事20条
  • 网站底部备案百度知道下载安装
  • wordpress 选择用户登录seo的优化技巧有哪些
  • 最便宜 双网站建设seo类目链接优化
  • 广东网站开发项目seo关键词优化举例
  • glitch做网站网站seo优化运营
  • 鄄城网站建设seo优化托管
  • b2c电子商务模式的网站有哪些合肥seo网站建设
  • 图片素材的网站seo页面内容优化
  • 厦门做网站seo的网上宣传方法有哪些
  • 摄影网站规划设计书爱站长尾关键词挖掘工具
  • 昌乐网站制作价格统计网站流量的网站
  • 网站建设市场外贸怎么找客户资源
  • 仿v电影wordpress自贡网站seo
  • 微网站怎么做的好处广东seo价格是多少钱
  • 做网站品牌公司seo网站查询
  • 亚马逊网站如何做商家排名重庆seo技术教程博客
  • 建工网首页优化网哪个牌子好
  • 网站域名和密码seo是什么seo怎么做
  • 起飞页怎么做网站成都网站seo厂家
  • 做网站的程序员留备份巨量引擎广告投放
  • 目标网站都有哪些内容温州企业网站排名优化
  • 易语言做网站图片下载谷歌搜索引擎下载
  • 为网站的特色功能设计各种模板广州百度推广外包
  • 做软件界面的网站公司网址有哪些
  • 企业网站模板哪里好微信软文范例
  • 系统官网网站模板淘宝关键词top排行榜
  • 免费中文网站模板下载百度seo优化是做什么的