Xcode UI Testing "Failure attempting to launch"
Asked Answered
P

0

6

I'm new to UI Testing and am trying to integrate the feature into an existing project. I'm trying the most basic of tests to just see the framework in action but am having some difficulty. I've added a new UI Testing Bundle target to my project and am able to run my basic test. However I keep getting a "Failure attempting to launch" error that always occurs when I'm trying to actually launch the app in my test. It also says something about a "nil token for current process reference".

Here's the code that I'm testing out:

@implementation SKYPracticeUITesting

- (void)setUp {
    [super setUp];

    // Put setup code here. This method is called before the invocation of each test method in the class.

    // In UI tests it is usually best to stop immediately when a failure occurs.
    self.continueAfterFailure = NO;
    // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
    XCUIApplication *app = [[XCUIApplication alloc] init];

    // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
    [app launch];
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // Use recording to get started writing UI tests.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
    NSLog(@"Something is happening");
}
@end

Any help would be greatly appreciated, especially considering the process in Objective-C isn't very well documented.

Place answered 9/5, 2016 at 18:19 Comment(5)
Have you used pods in this project?Parthen
Can you please post the exact message?Andriette
Trying to get it to repeat but now it's hit or miss. Will add the exact message once I get the error to repeat.Place
@Place please take a look at this answer: #36409560 - it helped meEwen
This might be the same question: #36413559Hydrotropism

© 2022 - 2024 — McMap. All rights reserved.