In XCTest you aren't in mainBundle. So get your image from your XCTest bundle.
(this solution is for iOS8+)
ObjC
[UIImage imageNamed:@"..." inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];
Swift
UIImage(named: "...", in: Bundle(for: type(of: self)), compatibleWith: nil)