XCTest resources aren't being copied into place correctly

So I have a project with an Objective-C framework which has unit tests.

One of the unit tests has a file 'sample.emlx' in its 'Resources' folder, which has its target membership set to the tests target.

I expect this file to be copied into the correct place, such that I can find it (in the 'setup') method with:


    NSBundle *bundle    = [NSBundle bundleForClass:[self class]];
    NSString *path      = [bundle pathForResource:@"sample" ofType:@"emlx"];
    NSData *content     = [NSData dataWithContentsOfFile:path];
    NSString *entire    = [NSString stringWithUTF8String:content.bytes];
    _sample             = [entire componentsSeparatedByString:@"\n"];
    NSLog(@"sample lines: %d", (int)_sample.count);

The idea is to make an array where I can pull various subsections of lines out to test various parts of the code.

This works every time, if I set a breakpoint at the "create the NSBundle" line, and single-step through the code after right-clicking on the specific test method I want to run

It never works if I just right-click on the specific test method I want to run and allow it to run freely. I will always see "sample lines: 0"

This is with the latest public Xcode, I haven't tried any beta variant.

XCTest resources aren't being copied into place correctly
 
 
Q