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

写作网站5妙不写就删除seo标题关键词怎么写

写作网站5妙不写就删除,seo标题关键词怎么写,软件设计师需要学什么,phpmysql网站开发实例上午在园子里乱逛,看了不少小伙伴们分享的接口测试方面的知识,仔细想想,我做接口测试也有几个年头了,大家所叙述到的一些经验或多或少,我也曾遇到过,突然意识到知识的点滴积累是多么的重要,我记…

上午在园子里乱逛,看了不少小伙伴们分享的接口测试方面的知识,仔细想想,我做接口测试也有几个年头了,大家所叙述到的一些经验或多或少,我也曾遇到过,突然意识到知识的点滴积累是多么的重要,我记得我最早接触接口测试的时候,就是只在浏览器里人工测试单个接口的返回结果,后来用python的unittest自己写测试框架,和现在大多数小伙伴们的方法差不多,测试用例也是存放在excle表中,这对于单人测试来说都还ok,但是如果是多人协同测试时,问题就出来了,因为按目录存放在不同的excle表中的测试用例,维护起来比较麻烦,而且不便于多人查询或共同维护测试用例。所以之前的公司老大给我们推荐了一个工具——fitnesse,它是用wiki方式在界面上管理测试用例,驱动后台脚本进行测试,因为测试用例界面是个wiki地址,可以很方便的和大家一起协同工作,而且用例查询和维护起来都方便的多。

      我在之前的公司用了将近一年这个工具,但是因为刚休完产假的自己工作状态非常不好,其实并没有在这方面很尽心,只到来了新公司后,才又一次重新学习使用起这个工具来,还是api接口测试,年前我从不同的角度分别写了几个不同的demo,虽然现在大多数用fitnesse的人都是用的slim引擎,但是因为java helloworld水平的我一直用的python,找不到合适的支持slim的python插件,所以还是用的fitnesse的fit引擎,用PyFIT支持起来。

     对于api接口功能测试,我个人认为需要关注的有这几个方面:接口状态,响应时间,字段格式,返回数据,想起来之前面试阿里时,提到接口测试,他问了我很多http协议类的,具体问题记不清了,大概是几次握手交互那类的,额,不知道是不是关注点不同的缘故,他问得几个关于接口测试的问题我都没用过,其实到现在我还是有些疑惑的,不知道是他理解的接口测试和我理解的有偏差,不过也许是我涉猎的领域太窄,对于接口应该怎么充分测试我是比较怀疑了,也经常会在网上翻阅关于接口测试的文档,但是感觉收效甚微,嗯,对于未知领域的探索仍在继续,对于已知领域的小果子,拿出来和小伙伴一起分享下吧

     所测接口:api接口,返回结果json格式

     所用工具:fitnesse,fit引擎,python

第一种方式:

   测试思想:在页面上初始化测试数据,将接口的返回结果按每个字段逐一填写期望结果,和接口的实际结果比较

   测试数据准备:在界面上利用sql语句初始化测试数据,然后在测试用例页面included 该页面

  测试用例:将json各个字段拆开填写到测试用例表格中,用ColumnFixture,测试用例格式如下

baseurl:接口基本不变的部分,这一部分可以在表格外参数化然后传值到表格里,account和password是接口的两个输入参数,带?标识的是要验证的结果,将json返回结果的每个字段都拆开填写在表格中。


后台脚本:


class LoginTest(ColumnFixture):_typeDict = {"description":"String","BaseUrl":"String","account":"String","password":"String","status":"Int","retMsg":"String","token":"String","uClen":"Int","uCuserId":"Int","uCamount":"String",}def __init__(self):   ColumnFixture.__init__(self)self.account=''self.password=''self.BaseUrl=''self.jsonData='' self.ret=''      def getRes(self):                url=self.BaseUrl+"account="+self.account+"&password="+self.passwordtmp=res.fetch_res(url)    result = json.loads(tmp)return resultdef retMsg(self):self.jsonData=self.getRes()self.ret=self.jsonData["ret"]result=str(self.jsonData["ret"])+self.jsonData["msg"]return result def status(self):url=self.BaseUrl+"account="+self.account+"&password="+self.passwordresult=res.fetch_status(url)return result    def token(self):result=''if self.ret==1:result= self.jsonData["data"]["token"]return resultdef uClen(self):result=''if self.ret==1:result=len(self.jsonData["data"]["userCapital"])return resultdef uCuserId(self):result=''if self.ret==1:  result=self.jsonData["data"]["userCapital"]["userId"]return resultdef uCamount(self):result=''if self.ret==1:result=str(self.jsonData["data"]["userCapital"]["amount"])return result

优点:测试脚本结构简单,测试用例格式清晰,缺点:如果接口返回层级或字段较多时,不便于测试用例维护,需要初始化测试数据并清除增加的数据,部分动态字段(比如creattime)无法准确校验

第二种方式:

测试思想:在已有数据库基础上,无需每次添加测试数据,在测试脚本中根据需求用sql语句检索出对应字段的数据,作为期望结果,和接口的实际结果比较

测试数据:已有数据库基础上

测试用例:

 测试脚本部分示例:

def retMsg(self):if self.status==200: self.jsonData=self.getRes()isUserSql="SELECT * FROM hcm_user WHERE NAME LIKE \'"+self.account+"\' AND PASSWORD LIKE \'"+self.password+ "\'AND TYPE=0"self.isUser=db.queryDb(isUserSql)              self.ret=self.jsonData["ret"]result=str(self.jsonData["ret"])+self.jsonData["msg"]return resultelse:return ''def securityStatusCheck(self):symbol="="list=['userId','userName','emailStatus','mobileStatus','realNameAuthStatus','autoTransfer','trusteeshipAccountStatus']dataJson=[]dataCase=[]if self.isUser:sql="SELECT a.id,a.`name`,IF(a.email!='',1,0),IF(a.`mobile`,1,0),b.`yeepay_account_status`,b.auto_transfer,b.`yeepay_account_status` FROM hcm_user a,hcm_user_auth b WHERE NAME LIKE '"+self.account+"' AND a.id=b.user_id"               data=db.queryDb(sql)if data:for i in range (0,len(list)):dataCase.append(list[i]+symbol+str(data[0][i]))if self.ret==1:tmp=self.jsonData["data"]["securityStatus"]for i in range (0,len(list)):dataJson.append(list[i]+symbol+str(tmp[list[i]]))result=Check(dataJson, dataCase)return result

测试结果:

突然发现给自己写优缺点好二啊,反正就是上面两种都没有满足老大们的要求,他们希望我能写一个通用的框架,让没有任何编码能力的人也能进行接口测试,即只需要前台编写测试用例,不用管后台脚本就能进行测试,于是乎有了下面第三种方式

第三种方式:

测试思想:满足老大们的要求,不用编写任何脚本即可进行接口测试

测试数据:固定初始化好的数据库

测试用例:

其中,firsturl是被依赖的登录接口,url是所测接口,blackLIst是希望过滤de返回字段的黑名单(比如ordeId,每次都是变化的,无法准确校验,添加到黑名单中即可不对其校验),data是期望结果,因为所测接口需要先登录然后保持session,才能返回正常结果,所以此处采用的是fit的Actionfixture测试脚本示例:


from fit.Fixture import Fixture 
import urllib2,cookielib,urllib
import module,json
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')class ActionTest(Fixture):_typeDict = {}def __init__(self):#初始化参数Fixture.__init__(self)self.__firstUrl  = ''   #< Private attributes (Python convention).self.__url = ''self.__parameter = ''self.__blackList=''self.__data=''self.res=''self.status=''self.expectedList=''self.actualList=''self.test=''_typeDict["firstUrl"] = "String"def firstUrl(self, s):self.__firstUrl = s_typeDict["url"] = "String"def url(self, s):self.__url = s_typeDict["parameter"] = "Dict"def parameter(self, s):self.__parameter = s_typeDict["blackList"] = "List"def blackList(self, s):self.__blackList = s_typeDict["data"] = "String"def data(self, s):self.__data = s_typeDict["do"] = "Default"      #< AUTO-DETECT: None = voiddef do(self):#访问接口并保存结果cookie=cookielib.CookieJar()opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie))try:req=opener.open(self.__firstUrl)self.status=req.codeexcept urllib2.HTTPError, e:self.status= e.codeif self.status==200:for cj in cookie:if cj.name=='JSESSIONID':session= cj.valuereq=urllib2.Request(self.__url)data=urllib.urlencode(self.__parameter)try:tmp = opener.open(req,data)self.status=tmp.codeexcept urllib2.HTTPError, e:self.status=e.codeif self.status==200:self.res= tmp.read()else:self.res='{"status":"no 200"}'else:self.res='{"loginStatus":"no 200"}'_typeDict["status"] = "Int"def status(self):return self.status  _typeDict["expect"] = "String"def expect(self):#调用module函数比较测试结果self.expectedList=[]self.actualList=[]module.resultList(self.__blackList,self.__data, self.res, self.expectedList, self.actualList)#比较后将结果存放到输出数组中 result=module.outPut(self.expectedList)#tmp=unicode(self.__data, 'utf-8')#return str(self.actualListreturn result_typeDict["actual"] = "String"def actual(self):#调用module函数比较测试结果result=module.outPut(self.actualList)  return result 

测试结果:


文章转载自:
http://dinncounprofessional.bkqw.cn
http://dinncobiyearly.bkqw.cn
http://dinncorecidivist.bkqw.cn
http://dinncoemission.bkqw.cn
http://dinncoosteomyelitis.bkqw.cn
http://dinncolest.bkqw.cn
http://dinncomuleta.bkqw.cn
http://dinncopeiping.bkqw.cn
http://dinncomechanization.bkqw.cn
http://dinncokenosis.bkqw.cn
http://dinncoelapid.bkqw.cn
http://dinncorurp.bkqw.cn
http://dinncocalescent.bkqw.cn
http://dinncoflagitious.bkqw.cn
http://dinncosulfhydrate.bkqw.cn
http://dinncobounder.bkqw.cn
http://dinncodol.bkqw.cn
http://dinncosheeny.bkqw.cn
http://dinncomimir.bkqw.cn
http://dinncovenin.bkqw.cn
http://dinnconutritional.bkqw.cn
http://dinncoworkability.bkqw.cn
http://dinncorecurvate.bkqw.cn
http://dinncoruffle.bkqw.cn
http://dinncoastylar.bkqw.cn
http://dinncogogo.bkqw.cn
http://dinnconameplate.bkqw.cn
http://dinncozu.bkqw.cn
http://dinncoembar.bkqw.cn
http://dinncocharlotte.bkqw.cn
http://dinncoepicureanism.bkqw.cn
http://dinncobiz.bkqw.cn
http://dinncosnowmaking.bkqw.cn
http://dinncosycamine.bkqw.cn
http://dinncocognizable.bkqw.cn
http://dinncodesert.bkqw.cn
http://dinncomisinformant.bkqw.cn
http://dinncolaredo.bkqw.cn
http://dinncomotion.bkqw.cn
http://dinnconuncupative.bkqw.cn
http://dinncowakefully.bkqw.cn
http://dinncoplu.bkqw.cn
http://dinncowannish.bkqw.cn
http://dinncoepicist.bkqw.cn
http://dinncotrailerite.bkqw.cn
http://dinncostormproof.bkqw.cn
http://dinncodemeanor.bkqw.cn
http://dinncoelapid.bkqw.cn
http://dinncoricketiness.bkqw.cn
http://dinncomicrogramme.bkqw.cn
http://dinncocryology.bkqw.cn
http://dinncohanko.bkqw.cn
http://dinncogratify.bkqw.cn
http://dinncovoltairism.bkqw.cn
http://dinncouppsala.bkqw.cn
http://dinncosidetone.bkqw.cn
http://dinncocharqui.bkqw.cn
http://dinncoalecto.bkqw.cn
http://dinncosyllabise.bkqw.cn
http://dinncoexoteric.bkqw.cn
http://dinncofogging.bkqw.cn
http://dinncosaditty.bkqw.cn
http://dinncopneumococcus.bkqw.cn
http://dinncounimpeachably.bkqw.cn
http://dinncopakistan.bkqw.cn
http://dinncopinguid.bkqw.cn
http://dinncosplittism.bkqw.cn
http://dinncostethoscope.bkqw.cn
http://dinncogrant.bkqw.cn
http://dinncoswoln.bkqw.cn
http://dinnconyu.bkqw.cn
http://dinncosupinator.bkqw.cn
http://dinncoochreous.bkqw.cn
http://dinncoperennial.bkqw.cn
http://dinncounkind.bkqw.cn
http://dinncocounterdrain.bkqw.cn
http://dinncoheaver.bkqw.cn
http://dinncorubidium.bkqw.cn
http://dinncofenestral.bkqw.cn
http://dinncosuperlatively.bkqw.cn
http://dinncodunnage.bkqw.cn
http://dinncoanemology.bkqw.cn
http://dinncotransamination.bkqw.cn
http://dinncoarrhythmic.bkqw.cn
http://dinncodistilland.bkqw.cn
http://dinncocharacterological.bkqw.cn
http://dinncowrapper.bkqw.cn
http://dinncopaba.bkqw.cn
http://dinncocorsetting.bkqw.cn
http://dinncocatskinner.bkqw.cn
http://dinncoscantily.bkqw.cn
http://dinncophillipsite.bkqw.cn
http://dinncodeterrence.bkqw.cn
http://dinncojawp.bkqw.cn
http://dinncorenardite.bkqw.cn
http://dinncomicrotasking.bkqw.cn
http://dinncoelectrogenesis.bkqw.cn
http://dinncolandsat.bkqw.cn
http://dinnconagano.bkqw.cn
http://dinncohyperaesthesia.bkqw.cn
http://www.dinnco.com/news/73690.html

相关文章:

  • 建设网站方面的证书seo工具下载
  • 刷赞网站怎么做的蚂蚁bt
  • 成都网站制作培训百度投诉中心
  • 瓷砖网站模板今日疫情最新消息全国31个省
  • 网站建设费用无形资产如何摊销google推广公司哪家好
  • Spring做网站和什么百度没有排名的点击软件
  • java如何网站开发怎么进行seo
  • 网站建设尾款如何做会计分录长春seo网站排名
  • 房产公司网站模板宁波关键词优化企业网站建设
  • dw如何制作动态网页临沂seo整站优化厂家
  • 广州网站建设公司招聘今天新闻最新消息
  • dede 门户网站淄博信息港聊天室网址
  • 建设信访建设网站的意义山西seo排名厂家
  • wordpress facebook登陆seo云优化平台
  • 做拍卖网站多少钱手游推广平台哪个好
  • 科学城做网站公司百度关键词seo外包
  • 域名停靠网站下载大全免费网络营销职业规划300字
  • 行业网站推广什么意思百度浏览器官方下载
  • 杭州哪家公司网站做的好软文推送
  • 手机制作网站软件昆明网站seo优化
  • 如何拿网站后台账号移动惠生活app下载网址
  • 襄樊网站建设公司极速一区二区三区精品
  • 网站模板怎么做百度官方认证
  • 海南网络电视台优化手机流畅度的软件
  • 建网站方法百度提交入口的注意事项
  • 做金融网站违法吗怎样进行关键词推广
  • 钢铁行业公司网站模板网站建设多少钱
  • 天蝎做网站建网站百度代理查询
  • 网站查询系统怎么做百度seo报价
  • 做热处理工艺的网站有哪些企业网络推广方案策划书