我正在将DVR集成到我正在编写的HTTP请求繁重库的测试中。我正在使用Swift Package Manager(在使用Xcode 11 Beta的macOS 10.15上)来管理我的依赖关系,而且我不确定如何将DVR生成的设备包含到测试目标中。如何将我的装置从DVR添加到测试目标?
我尝试使用默认的Session配置,并尝试使用Session(outputDirectory: "Fixtures", cassetteName: "example", testBundle: .main, backingSession: .shared)
我的软件包文件如下:
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Example",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "Example",
targets: ["Example"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/venmo/DVR.git", from: "2.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "Example",
dependencies: []
),
.testTarget(
name: "ExampleTests",
dependencies: ["Example", "DVR"]
)
]
)
运行测试时,出现错误[DVR] Persisted cassette at Fixtures/example.json. Please add this file to your test target
我不确定如何将此目录添加到我的测试目标中。