4

My tests do not start executing, and always timeout every time I try to use an xcodebuild command.

The command that I used is the following:

xcodebuild -workspace App.xcworkspace -scheme 'AppName' -sdk iphonesimulator -configuration 'UI_Automation' CODE_SIGN_STYLE='Manual' CODE_SIGN_IDENTITY='iPhone Developer: John Smith (XXXXXXXX)' PROVISIONING_PROFILE_SPECIFIER='John Smith PP Name' DEVELOPMENT_TEAM='ABC Company Apple DEV' -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2' -destination-timeout 600 -only-testing:AppUITests clean test

It goes through a process where the app is built, but then the tests do not start executing. As a matter of fact, the Simulator does not even start, and I get the following error.

Testing failed:
Timed out waiting for AX loaded notification If you believe this error represents a bug, please attach the log file at /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/com.apple.dt.XCTest/IDETestRunSession-60333F56-66CA-4C34-8460-3846DCF59C14/AppUITests-F74C4FDD-17EE-44AD-A2BA-DDB1BC0A1D7E/Session-AppUITests-2017-12-28_150211-qwlao1.log

Does anyone know how to fix this? I have been racking my brain around this for the past 2 weeks and can't figure it out.

John Smith
  • 353
  • 1
  • 4
  • 9

2 Answers2

0

xcode build command changed since xcode 9. So you have to change your build command.

Follow the mentioned steps:

  • First build the project. Command for build app is

    xcodebuild build-for-testing -workspace "Your.xcworkspace" -scheme "UpgradeAll" -destination "platform=iOS Simulator,name=iPad Air,OS=11.0" -derivedDataPath "All"
    
  • Then execute the test command using this.

    xcodebuild test-without-building -xctestrun "All/Build/Products/UpgradeAll_iphonesimulator11.0-x86_64.xctestrun" -destination "platform=iOS Simulator,name=iPad Air,OS=11.0" '-only-testing:YourTestbundleName' -derivedDataPath 'build/reports/bundleName' | tee xcodebuild.log | ios-sim start --devicetypeid "iPad-Air, 11.0" 
    
Mahmud Riad
  • 1,169
  • 1
  • 8
  • 19
  • Thanks for replying to my comment. So the tests are still not starting up although the simulator does. I will see if there are any issues with the target, and reply back here. Thank you once again. – John Smith Jan 02 '18 at 18:02
  • @JohnSmith Sure. i am waiting for your feedback – Mahmud Riad Jan 02 '18 at 19:13
  • The first command worked fine. But the second one, I get BROKEN PIPE errors stemming from the xcpretty command. If I remove the xcpretty part, then it works fine. If you can just correct the second command, I'll be glad to mark it as the answer. – John Smith Jan 05 '18 at 18:27
  • @john Smith i have edited the answer. You can accept it and upvofe it so that others can find it helpful. – Mahmud Riad Jan 06 '18 at 03:00
  • Done, thanks. Can you also confirm how to use the above commands on a real device? – John Smith Jan 08 '18 at 17:57
  • You are most welcome. I will let you know the procedure of testing real devices – Mahmud Riad Jan 08 '18 at 19:06
  • I figured it out. There is something else that I need your help with. I observed that the "addUIInterruptionMonitor(withDescription: "Push notifications")" listener to dismiss alerts does not work on Xcode 9/iOS 10 test executions. Do you happen to have a workaround for it? – John Smith Jan 09 '18 at 23:56
  • It is a different issue. Please open a new question in different thread and lets discuss and try to resolve it – Mahmud Riad Jan 10 '18 at 07:38
0

I got this error when trying to run my UI Tests through jenkins. What I did was:

Rebooted my Mac Mini and the UI Tests work now.

Moisés Olmedo
  • 919
  • 1
  • 17
  • 15