SwiftPM Test Fixtures

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?

The way that we have been doing this is by using `#file` to derive the location of the test data. It is gross, but it works until we have a real resource story.

- Daniel

ยทยทยท

On Nov 17, 2016, at 7:07 PM, Ryan Lovelett via swift-build-dev <swift-build-dev@swift.org> wrote:

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?
_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev