Nimble-SnapshotTesting
Nimble 的一个匹配器,灵感来自 https://github.com/pointfreeco/swift-snapshot-testing,以及 https://github.com/ashfurrow/Nimble-Snapshots 和 https://github.com/Killectro/swift-snapshot-testing-nimble 中的工作
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
需求
Cocoapods 或 Swift 5.3 或更高版本,用于 Swift 包管理器
安装
Nimble-SnapshotTesting 通过 CocoaPods 提供使用。要安装它,只需将以下行添加到您的 Podfile 中
pod 'Nimble-SnapshotTesting'
对于 Swift 包管理器
.package(url: "https://github.com/tahirmt/Nimble-SnapshotTesting.git", .upToNextMajor(from: "2.0.0")),
使用方法
要使用 Nimble 使用此库,您有两种方法
let view = UIView()
expect(view).to(haveValidSnapshot(as: .image))
或者,您甚至可以使用 ==
语法
let view = UIView()
expect(view) == snapshot(as: .image)
许可证
Nimble-SnapshotTesting 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。