美文网首页
使用 Quick 和 Nimble 进行 Swift 单元测试

使用 Quick 和 Nimble 进行 Swift 单元测试

作者: iamjjh | 来源:发表于2019-05-17 10:28 被阅读0次
    1. 在单元测试的 Target -> General 勾选 Allow testing Host Application APIs
    2. 在 Podfile 中添加 Quick 和 Nimble
    3. 在 Podfile 中使用 use_frameworks! 或者 use_modular_headers! (单独指定:modular_headers => true也可以)

    忘记勾选 Allow testing Host Application APIs,在 import 第三方库的时候会报以下错误:

    Undefined symbols for architecture x86_64:
      "ObjectMapper.<- infix<A>(inout A, ObjectMapper.Map) -> ()", referenced from:
          DDBaseKitModule_Tests.TestModel.mapping(map: ObjectMapper.Map) -> () in DDModelTypeSpec.o
      "ObjectMapper.<- infix<A>(inout A?, ObjectMapper.Map) -> ()", referenced from:
          DDBaseKitModule_Tests.TestModel.mapping(map: ObjectMapper.Map) -> () in DDModelTypeSpec.o
      "(extension in DDBaseKitModule):Swift.Dictionary< where A == Swift.String>.queryStringParameters() -> Swift.String", referenced from:
          closure #1 () -> () in closure #1 () -> () in DDBaseKitModule_Tests.ExtensionSpec.spec() -> () in ExtensionSpec.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    相关文章

      网友评论

          本文标题:使用 Quick 和 Nimble 进行 Swift 单元测试

          本文链接:https://www.haomeiwen.com/subject/cylnaqtx.html