Say you have a class with some private properties that you would rather not expose at the header level, but you would sure like to use in a test.

One trick some colleagues showed me is you can redefine the interface in your test, and expose whatever properties and methods you want access to there.

Here I have a class called IAPClientImplementation and I want to expose the currentRequstId property. I can do that like this.

#import "IAPClientImplementationTestBase.h"

@interface IAPClientImplementation()
@property (nonatomic, readwrite) NSUInteger currentRequestID;
@end

@interface IAPClientImplementationTest : IAPClientImplementationTestBase
@end

@implementation IAPClientImplementationTest

- (void)testRequestIdIncrements {
    XCTAssertEqual(0, [self.client currentRequestID]);
}

@end