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

网站开发用哪个框架淘宝如何提升关键词排名

网站开发用哪个框架,淘宝如何提升关键词排名,网站的登录界面是怎么做的,微管家里的微网站怎么建设文章目录 使用QuickNimble1、苹果官方测试框架XCTest的优缺点2、选择QuickNimble的原因:3、QuickNimble使用介绍集成:Quick关键字说明:Nimble中的匹配函数等值判断:使用equal函数是否是同一个对象:使用beIdenticalTo函…

文章目录

    • 使用Quick+Nimble
      • 1、苹果官方测试框架XCTest的优缺点
      • 2、选择Quick+Nimble的原因:
      • 3、Quick+Nimble使用介绍
        • 集成:
        • Quick关键字说明:
        • Nimble中的匹配函数
          • 等值判断:使用equal函数
          • 是否是同一个对象:使用beIdenticalTo函数
          • 比较:
          • 比较浮点数
          • 类型检查
          • 是否为真
          • 是否有异常
          • 集合关系
          • 字符串
          • 检查集合中的所有元素是否符合条件
          • 检查集合个数
          • 匹配任意一种检查
      • 4、Quick使用总结

使用Quick+Nimble

github地址

1、苹果官方测试框架XCTest的优缺点

优点:与 Xcode 深度集成,有专门的Test 导航栏。

缺点:
1)因为受限于官方测试API,因此功能不是很丰富。
2)在书写性和可读性上都不太好。在测试用例太多的时候,由于各个测试方法是割裂的,想在某个很长的测试文件中找到特定的某个测试并搞明白这个测试是在做什么并不是很容易的事情。
3)所有的测试都是由断言完成的,而很多时候断言的意义并不是特别的明确,对于项目交付或者新的开发人员加入时,往往要花上很大成本来进行理解或者转换。另外,每一个测试的描述都被写在断言之后,夹杂在代码之中,难以寻找。
4)使用XCTest测试另外一个问题是难以进行mock或者stub

2、选择Quick+Nimble的原因:

主要是由于苹果官方框架的测试方法及断言不明确,可读性不好,难以分辨,交接项目需要花费的时间很多,所以建议采用三方测试框架
目前主流的三方测试框架主要有:
oc中:kiwi 、specta、cedar
swift:quick+nimble、Sleipnir
由于项目是使用的swift语言,所以主要采用quick+nimble,用于单元测试和断言。
如果你的项目是OC的,推荐使用kiwi,目前是start最多的三方框架。

3、Quick+Nimble使用介绍

Quick 是一个建立在XCTest 上,为Swift 和Objective-C 设计的测试框架. 对测试使用Swift编写的App非常友好,对Swift使用者来说,Quick是最佳选择
它通过DSL 去编写非常类似于RSpec 的测试用例。
Nimble 就像是Quick 的搭档,它提供了匹配器作为断言,用于编写匹配模式。

集成:

使用pod集成方便快捷:

pod ‘Quick’
pod ‘Nimble’

新建一个测试类,继承于QuickSpec父类,然后重写spec( )方法
示例代码:

finalfinal class BindDeviceTests: QuickSpec {override func spec() {//所有测试放在这里describe("test BindDeviceDB") {let findMac = "34:94:54:C2:E3:C6"let bindedMacs = ["34:94:54:C2:E3:C6","D8:0B:CB:62:08:5F","FF:F2:00:08:21:9C"]it("test saveBindDevice") {let bindDevice = BindDevice()bindDevice.scaleName = "test"bindDevice.userId = testLoginUserIdbindDevice.mac = testMacexpect(bindDevice.save()).to(beTrue())}it("test findBindDeviceList") {let list = BindDevice.findBindDeviceList()printLog(message: "test findBindDeviceWithMac: \(String(describing: list?.count))")expect(list?.count) == 6}......xit("test findNotUploadBindDevices") {let list = BindDevice.findNotUploadBindDevices()printLog(message: "test findNotUploadBindDevices: \(String(describing: list?.count))")expect(list).to(beNil())}}}}
Quick关键字说明:

在这里插入图片描述

Nimble中的匹配函数
等值判断:使用equal函数
  • expect(actual).to(equal(expected))
  • expect(actual) == expected
  • expect(actual) != expected
是否是同一个对象:使用beIdenticalTo函数
  • expect(actual).to(beIdenticalTo(expected))
  • expect(actual) === expected
  • expect(actual) !== expected
比较:
  • expect(actual).to(beLessThan(expected))
  • expect(actual) < expected
  • expect(actual).to(beLessThanOrEqualTo(expected))
  • expect(actual) <= expected
  • expect(actual).to(beGreaterThan(expected))
  • expect(actual) > expected
  • expect(actual).to(beGreaterThanOrEqualTo(expected))
  • expect(actual) >= expected
比较浮点数
  • expect(10.01).to(beCloseTo(10, within: 0.1))
类型检查
  • expect(instance).to(beAnInstanceOf(aClass))
  • expect(instance).to(beAKindOf(aClass))
是否为真
  • expect(actual).to(beTruthy())
  • expect(actual).to(beTrue())
  • expect(actual).to(beFalsy())
  • expect(actual).to(beFalse())
  • expect(actual).to(beNil())
是否有异常
  • // Passes if actual, when evaluated, raises an exception:
  • expect(actual).to(raiseException())
  • // Passes if actual raises an exception with the given name:
  • expect(actual).to(raiseException(named: name))
  • // Passes if actual raises an exception with the given name and reason:
  • expect(actual).to(raiseException(named: name, reason: reason))
  • // Passes if actual raises an exception and it passes expectations in the block
  • // (in this case, if name begins with ‘a r’)
  • expect { exception.raise() }.to(raiseException { (exception: NSException) in
    • expect(exception.name).to(beginWith(“a r”))
  • })
集合关系
  • // Passes if all of the expected values are members of actual:
  • expect(actual).to(contain(expected…))
  • expect([“whale”, “dolphin”, “starfish”]).to(contain(“dolphin”, “starfish”))
  • // Passes if actual is an empty collection (it contains no elements):
  • expect(actual).to(beEmpty())
字符串
  • // Passes if actual contains substring expected:
  • expect(actual).to(contain(expected))
  • // Passes if actual begins with substring:
  • expect(actual).to(beginWith(expected))
  • // Passes if actual ends with substring:
  • expect(actual).to(endWith(expected))
  • // Passes if actual is an empty string, “”:
  • expect(actual).to(beEmpty())
  • // Passes if actual matches the regular expression defined in expected:
  • expect(actual).to(match(expected))
检查集合中的所有元素是否符合条件
  • // with a custom function:
  • expect([1,2,3,4]).to(allPass({$0 < 5}))
  • // with another matcher:
  • expect([1,2,3,4]).to(allPass(beLessThan(5)))
检查集合个数
  • expect(actual).to(haveCount(expected))
匹配任意一种检查
  • // passes if actual is either less than 10 or greater than 20
  • expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20)))
  • // can include any number of matchers – the following will pass
  • expect(6).to(satisfyAnyOf(equal(2), equal(3), equal(4), equal(5), equal(6), equal(7)))
  • // in Swift you also have the option to use the || operator to achieve a similar function
  • expect(82).to(beLessThan(50) || beGreaterThan(80))

4、Quick使用总结

  • 使用Quick,编写it方法执行多个test方法,实际执行顺序,按照字母排序执行,可以从控制台打印得出
  • 单元测试的方法,保存、删除、修改等会对数据库真正意义上的修改
  • 使用xit,表示不测试这些方法
  • 当既有it又有fit,表示只会测试fit的方法( 只要存在f开头的方法,单元测试开始执行便只会执行f开头的方法,即使不在同一个测试类中
  • 当使用describe、context、it嵌套使用时,当最外层方法使用了x开头的,整个入口都不会进入测试,即使嵌套里面使用了f开头的

文章转载自:
http://dinncoheathenise.ssfq.cn
http://dinncodiurnally.ssfq.cn
http://dinncodiseasedness.ssfq.cn
http://dinncosmartless.ssfq.cn
http://dinncodroshky.ssfq.cn
http://dinncohemoptysis.ssfq.cn
http://dinncoagnes.ssfq.cn
http://dinncohipped.ssfq.cn
http://dinncoplanimeter.ssfq.cn
http://dinncoepifauna.ssfq.cn
http://dinncorecidivous.ssfq.cn
http://dinncodipetalous.ssfq.cn
http://dinncodocumental.ssfq.cn
http://dinncodromometer.ssfq.cn
http://dinncotripolite.ssfq.cn
http://dinncolivable.ssfq.cn
http://dinncoechinoderm.ssfq.cn
http://dinncosubdominant.ssfq.cn
http://dinncomyrrh.ssfq.cn
http://dinncopropitious.ssfq.cn
http://dinncogoldenrod.ssfq.cn
http://dinncoaeolotropy.ssfq.cn
http://dinncoconus.ssfq.cn
http://dinncotamer.ssfq.cn
http://dinncosimply.ssfq.cn
http://dinncohypochromia.ssfq.cn
http://dinncoihs.ssfq.cn
http://dinncohomocharge.ssfq.cn
http://dinncoiodize.ssfq.cn
http://dinncogauzily.ssfq.cn
http://dinncocriticises.ssfq.cn
http://dinncofriarbird.ssfq.cn
http://dinncohardtop.ssfq.cn
http://dinncoparachuter.ssfq.cn
http://dinncoyanam.ssfq.cn
http://dinncovapidity.ssfq.cn
http://dinncoprocambium.ssfq.cn
http://dinncoshowing.ssfq.cn
http://dinncolimnic.ssfq.cn
http://dinncoeeriness.ssfq.cn
http://dinncokythe.ssfq.cn
http://dinncoadenoidal.ssfq.cn
http://dinncoemulsion.ssfq.cn
http://dinncopropylaeum.ssfq.cn
http://dinncorepublicrat.ssfq.cn
http://dinncoboost.ssfq.cn
http://dinncosynchronoscope.ssfq.cn
http://dinncohinoki.ssfq.cn
http://dinncootitis.ssfq.cn
http://dinncoheadword.ssfq.cn
http://dinncomilky.ssfq.cn
http://dinncoincompletely.ssfq.cn
http://dinncoafterburner.ssfq.cn
http://dinncospot.ssfq.cn
http://dinncopolyvalent.ssfq.cn
http://dinncogalvanotactic.ssfq.cn
http://dinncolisted.ssfq.cn
http://dinncohandsomely.ssfq.cn
http://dinncoword.ssfq.cn
http://dinncodysthymia.ssfq.cn
http://dinncomistakeable.ssfq.cn
http://dinncobullterrier.ssfq.cn
http://dinncoredball.ssfq.cn
http://dinncomudir.ssfq.cn
http://dinncoebonite.ssfq.cn
http://dinncocarburetant.ssfq.cn
http://dinncoastrodome.ssfq.cn
http://dinncolastex.ssfq.cn
http://dinncohandbarrow.ssfq.cn
http://dinncoubiquitism.ssfq.cn
http://dinncocgs.ssfq.cn
http://dinncoblighted.ssfq.cn
http://dinncooutseg.ssfq.cn
http://dinncoeffusively.ssfq.cn
http://dinncohypospadias.ssfq.cn
http://dinncohalobiont.ssfq.cn
http://dinncoconversant.ssfq.cn
http://dinncogaudery.ssfq.cn
http://dinncothrowaway.ssfq.cn
http://dinncodeuterocanonical.ssfq.cn
http://dinncoheteroatom.ssfq.cn
http://dinncokaolin.ssfq.cn
http://dinncolooky.ssfq.cn
http://dinncounselective.ssfq.cn
http://dinncoshantytown.ssfq.cn
http://dinncowinterberry.ssfq.cn
http://dinncokenosis.ssfq.cn
http://dinncodreikanter.ssfq.cn
http://dinncorigmarole.ssfq.cn
http://dinncogsdi.ssfq.cn
http://dinncothanatology.ssfq.cn
http://dinncoinofficial.ssfq.cn
http://dinncoansi.ssfq.cn
http://dinncosurveyal.ssfq.cn
http://dinncoyenbo.ssfq.cn
http://dinnconebulize.ssfq.cn
http://dinncoshipowner.ssfq.cn
http://dinncotoilful.ssfq.cn
http://dinncojain.ssfq.cn
http://dinncomonial.ssfq.cn
http://www.dinnco.com/news/2683.html

相关文章:

  • 谁会网站开发舆情分析系统
  • 有什么那个网站seo公司哪家好
  • 销售网站制作电话百度一下你就知道百度官网
  • php网站建设案例教程网络推广平台软件
  • 应用公园app制作平台网站推广及seo方案
  • 网站建设3000字竞价排名的弊端
  • 青岛网站建设与管理电商代运营公司十强
  • 企业网站分析百度排名怎么做
  • 自己的网站怎么做隐藏内容站内seo和站外seo区别
  • 金华网站建设公司求职seo服务
  • 网站制作方案垂直领域获客windows7优化大师
  • 做网站龙头想学网络营销怎么学
  • 网站页面外链怎么做seo站
  • html5 wap网站方象科技的服务范围
  • 金融公司网站免费模板西安企业做网站
  • 网站icp是什么意思emlog友情链接代码
  • 赣州网站建设-赣州做网站长春网站关键词推广
  • wordpress diy插件广州seo工作
  • 卫龙模仿iphone做网站seo怎么优化简述
  • 网页主题参考seo搜索优化网站推广排名
  • 运涛网站建设小程序开发需要哪些技术
  • wordpress浮动视频优化师
  • 厚街外贸网站建设今日足球最新预测比分
  • 网站里添加聊天框怎么做高质量关键词搜索排名
  • 网站建设公司有前途吗西安网站制作
  • 郑州做网站哪里便宜电商网站怎样优化
  • 网站如何看是哪家公司做的产品宣传推广策划
  • 政府网站建设的重要意义免费站推广网站2022
  • 建设网站的软件优化排名推广教程网站
  • 长沙市网站制作公司世界十大网站排名出炉