[swift-users] SwiftPM Test Fixtures

Ryan Lovelett swift-dev at ryan.lovelett.me
Thu Nov 17 21:07:09 CST 2016


If I have a number of `*.json` files that are meant to be loaded and
used as a part of my SwiftPM test suite:

1. how do I get SwiftPM to bundle them with the test bundle?
2. how do I reference the fixtures in the test bundle?

## What I've tried...

I tried creating a top-level directory called `Fixtures`.  Then
referencing the bundle with something like:
`Bundle.allBundles.first(where: { $0.bundlePath.hasSuffix(".xctest")
})!.bundleURL`.

Is this even possible?


More information about the swift-users mailing list