Khant Thu Linn
Khant Thu Linn

Reputation: 6143

iOS UI Testing : Failure getting list of active applications: AX error -25205

I am still learning how to use UI Testing properly.

I login in the background and later, I show result in my news feed. Then, I tap on more button. When there is web service, it look like I can't get result from my api. It always fail like this and data from my api are not shown also. How shall I do?

enter image description here

Upvotes: 4

Views: 797

Answers (3)

Stan Sidel
Stan Sidel

Reputation: 479

Resetting the simulator resolved the issue for me. It can be done by Simulator - Reset Content and Settings... from the main menu of the simulator.

To use with CI systems, these commands might help:

osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all

Upvotes: 0

Moaz Saeed
Moaz Saeed

Reputation: 1016

I had same issue while using simulator. I tried running test case on device and it is working fine. So Run on actual device and see if error appears.

Upvotes: 2

Joe Masilotti
Joe Masilotti

Reputation: 17018

You shouldn't be using sleep() in your tests. Instead, use the native APIs to wait for elements to exist. For example, you can wait until the "Contests" text appears with the following:

XCUIApplication *app = [[XCUIApplication alloc] init];
XCUIElement *moreButton = app.tabBars.buttons[@"More"];

XCUIElement *contestsText = app.staticTexts[@"Contests"];
NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"];
[self expectationForPredicate:exists evaluatedWithObject:contestsText handler:nil];

[moreButton tap];

[self waitForExpectationsWithTimeout:5.0f handler:nil];
XCTAssert(contestsText.exists);

This example comes from my UI Testing Cheat Sheet. If you are just getting started with UI Testing I recommend you check it out.

Upvotes: 1

Related Questions