简体   繁体   中英

How to run automated XCUITests in Xcode for iOS via .ipa

I am facing an issue which ultimately results in following error -

The bundle “$(PRODUCT_NAME)” couldn’t be loaded because its executable couldn’t be located. Try reinstalling the bundle.
Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo=
{NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

I have been working on getting my UITest automated but i am intermittently(though 80% of the time) facing the above issue.

I am using the following command from command line .

xcodebuild -project Commute.xcodeproj -scheme CommuteUITests -configuration Debug test -destination "platform=iOS,name=$DEVICE_NAME" -derivedDataPath $DERIVED_DATA_DIR -only-testing:CommuteUITests/$SUITE . 

where everything have there usual meaning but this results in above error, and also i sometime provide multiple destinations.

On the other hand i want to run .ipa instead of building via source code.

So basically there are 2 problems here -

  • Why do i get these errors, i hovered around the internet but i'm not able to find the solution?
  • How to do i start my tests for testing an .ipa?

Someone please help me i'm stuck here big time, any help/pointer is greatly appreciated.

If you are still having this issue please check that your tests are picking up the correct info.plist file. If the tests pick up the incorrect info.plist file it will result in the following error:

The bundle “$(PRODUCT_NAME)” couldn’t be loaded

I know you are not using cocoapods but this guy had the same issue:

https://github.com/CocoaPods/CocoaPods/issues/7178

So make sure your tests are using the correct info.plist. Hope this helps!

As the mentioned answer was not sufficient enough, here are my additional insights:

Yes, there was an Info.plist file loaded, which should not have been loaded. But where did it come from?

My Tests target (in particular my UI Tests target) had an Info.plist file on their own, that was just fine, until I decided to make use of the @testable opportunity given by Xcode nowadays. Open your file-browser of your project in Xcode: + 0 then + 1 Enter in the search field at the bottom Info.plist

Now I had two referenced Info.plist-files:

  1. Info.plist with Target Membership to the Target Application (which classes are also imported via @testable)
  2. Info.plist with Target Membership was the (UI) Testing Target

Just deselect the 2nd Info.plist Target membership (or delete it, if you don't need it anymore) and should be all fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM