Doing a one-time setup in XCTest requires two parts:
XCTest has an init method that can do one-time setup. Here is an example:
public class TestSetup: NSObject {
override init() {
super.init()Next, set this in your test Info.plist like this:
<key>NSPrincipalClass</key>
<string>$(TARGET_NAME).TestSetup</string>