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

网站广告联盟怎么做的网站空间 哪个公司好

网站广告联盟怎么做的,网站空间 哪个公司好,合肥网页设计兼职,wordpress 太慢文章目录 使用QuickNimble1、苹果官方测试框架XCTest的优缺点2、选择QuickNimble的原因#xff1a;3、QuickNimble使用介绍集成#xff1a;Quick关键字说明#xff1a;Nimble中的匹配函数等值判断#xff1a;使用equal函数是否是同一个对象#xff1a;使用beIdenticalTo函… 文章目录 使用QuickNimble1、苹果官方测试框架XCTest的优缺点2、选择QuickNimble的原因3、QuickNimble使用介绍集成Quick关键字说明Nimble中的匹配函数等值判断使用equal函数是否是同一个对象使用beIdenticalTo函数比较比较浮点数类型检查是否为真是否有异常集合关系字符串检查集合中的所有元素是否符合条件检查集合个数匹配任意一种检查 4、Quick使用总结 使用QuickNimble github地址 1、苹果官方测试框架XCTest的优缺点 优点与 Xcode 深度集成有专门的Test 导航栏。 缺点 1因为受限于官方测试API因此功能不是很丰富。 2在书写性和可读性上都不太好。在测试用例太多的时候由于各个测试方法是割裂的想在某个很长的测试文件中找到特定的某个测试并搞明白这个测试是在做什么并不是很容易的事情。 3所有的测试都是由断言完成的而很多时候断言的意义并不是特别的明确对于项目交付或者新的开发人员加入时往往要花上很大成本来进行理解或者转换。另外每一个测试的描述都被写在断言之后夹杂在代码之中难以寻找。 4使用XCTest测试另外一个问题是难以进行mock或者stub 2、选择QuickNimble的原因 主要是由于苹果官方框架的测试方法及断言不明确可读性不好难以分辨交接项目需要花费的时间很多所以建议采用三方测试框架 目前主流的三方测试框架主要有 oc中kiwi 、specta、cedar swiftquicknimble、Sleipnir 由于项目是使用的swift语言所以主要采用quicknimble用于单元测试和断言。 如果你的项目是OC的推荐使用kiwi目前是start最多的三方框架。 3、QuickNimble使用介绍 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:C6let 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 testbindDevice.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) expectedexpect(actual) ! expected 是否是同一个对象使用beIdenticalTo函数 expect(actual).to(beIdenticalTo(expected))expect(actual) expectedexpect(actual) ! expected 比较 expect(actual).to(beLessThan(expected))expect(actual) expectedexpect(actual).to(beLessThanOrEqualTo(expected))expect(actual) expectedexpect(actual).to(beGreaterThan(expected))expect(actual) expectedexpect(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 20expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20)))// can include any number of matchers – the following will passexpect(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 functionexpect(82).to(beLessThan(50) || beGreaterThan(80)) 4、Quick使用总结 使用Quick编写it方法执行多个test方法实际执行顺序按照字母排序执行可以从控制台打印得出单元测试的方法保存、删除、修改等会对数据库真正意义上的修改使用xit表示不测试这些方法当既有it又有fit表示只会测试fit的方法 只要存在f开头的方法单元测试开始执行便只会执行f开头的方法即使不在同一个测试类中当使用describe、context、it嵌套使用时当最外层方法使用了x开头的整个入口都不会进入测试即使嵌套里面使用了f开头的
http://www.pierceye.com/news/11324/

相关文章:

  • 互助网站开发2018网站建设高考成绩查询
  • 信息查询类网站是怎么做的外贸一般上什么网站
  • 网站中图片怎么做的做淘宝客没网站怎么做
  • 建设网站目的及功能定位网络运维工程师证书怎么考
  • php网站上做微信支付功能里水九江网站建设
  • 网站建设全部教程专业企业网站建设公司价格
  • 做旅游攻略比较好的网站免费图表制作网站
  • 东坑镇网站建设西宁做网站君博专注
  • 彩票网站开发违法电子商务网站建设课程评价
  • 哈尔滨网站制作公司wordprees可以做棋类网站吗
  • 建微网站网站建设合同样本
  • html 网站根目录四川建设银行手机银行下载官方网站
  • 营销型网站是什么意思wordpress 表白
  • 卢氏县住房和城乡规划建设局网站网站建设上传宝贝xamp
  • 个人免费开店的网站查征信怎么查 个人免费查询
  • 定制设计的网站怎样申请免费网站域名
  • 品牌创意网站建设白云区做网站
  • 浙江建设厅官方网站做公众号链接的网站
  • 做箱包外贸哪个网站好都网站建设
  • 中文域名怎样绑定网站网站建设制作设计公司佛山
  • ui设计师与网站编辑有什么关系c#做交易网站
  • wordpress门户网站模板学历提升培训机构
  • 直播网站怎么做国家提供的免费网课平台
  • 云空间的网站wordpress删除版权
  • 企业网站建设的步骤过程中学生制作网站怎么做
  • 网站空间有哪几种类型蓝色门户网站
  • 大酒店网站源代码数字营销1+x
  • 怎么把自己网站推广出去手机网站开发session
  • 长沙微网站建设专门帮做ppt的网站吗
  • 自己做网站投入seo是什么意思广东话