plu / pxctest

Execute tests in parallel on multiple iOS Simulators
MIT License
800 stars 57 forks source link

pxctest - build and run-tests issue #8

Open cliren opened 7 years ago

cliren commented 7 years ago

Any idea what's going on here? The build succeeded but it didn't generate $PWD/build/Products/. xctestrun file. But an .xctest run file is generated at Build/Intermediates/CodeCoverage/Products/MyApp_iphonesimulator10.1-x86_64.xctestrun, when run this location getting an error as shown below.

` Xcode 8.1 Build version 8B62

xcodebuild \ -IDEBuildLocationStyle=Custom \ -IDECustomBuildLocationType=Absolute \ -IDECustomBuildProductsPath="$PWD/build/Products" \ -scheme 'MyApp' \ -workspace 'MyApp.xcworkspace' \ -destination 'platform=iOS Simulator,name=iPhone 5,OS=10.1' \ build-for-testing

pxctest \

run-tests \ --destination 'name=iPhone 5,os=iOS 10.1' \ --testrun Build/Intermediates/CodeCoverage/Products/MyAppUnitTests_iphonesimulator10.1-x86_64.xctestrun

Error Domain=com.facebook.XCTestBootstrap Code=0 "Failed to find test host application" UserInfo={NSLocalizedDescription=Failed to find test host application, NSUnderlyingError=0x7f845045a1d0 {Error Domain=com.facebook.FBControlCore Code=0 "Could not obtain Bundle ID for app at path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest" UserInfo={NSLocalizedDescription=Could not obtain Bundle ID for app at path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest}}} `

okanerdogan09 commented 7 years ago

it is same for me when i remove build-for-testing i see a build/Products file is created.But still could'nt manage to create a .xctestrun file. And in PhaseScriptExecution part I see > Debug Warning: Could not remove unsupported architecture in build phase. This is the only warning i can see

xcodebuild \ -IDEBuildLocationStyle=Custom \ -IDECustomBuildLocationType=Absolute \ -IDECustomBuildProductsPath="$PWD/build/Products" \ -scheme 'Staging' \ -workspace 'lng.xcworkspace' \ -destination 'platform=iOS Simulator,name=iPhone 5,OS=10.1'

plu commented 7 years ago

The build succeeded but it didn't generate $PWD/build/Products/. xctestrun file.

All the projects I could get my hand on were generating the xctestrun file in the given directory once I passed all the three -IDE... options. You're using the correct options. I assume the products are not put into that folder because of some build setting in your project. Which one that might be, I don't know, sorry.

Failed to find test host application

It looks like you're trying to run some test target that does not have a Host Application. Unfortunately this is not supported currently.

screen shot 2016-12-13 at 03 54 48

atineoSE commented 7 years ago

I'm facing the same problem: the xctestrun file is not being generated, despite following the instructions.

This is a complex project with several targets and schemes and don't know where to start looking. Any tips?

ollieatkinson commented 7 years ago

if you have code coverage enabled, the xctestrun gets placed in the derived data (despite you asking it to).

e.g.

      xcodebuild \
            -derivedDataPath /tmp/derivedData \
            -scheme 'ExampleScheme' \
            -workspace 'Example.xcworkspace' \
            -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.0' \
            build-for-testing"

Then check /tmp/derivedData/Build/Intermediates/CodeCoverage/Products/.

specifying your own derived data path and extracting it from there seems OK.

atineoSE commented 7 years ago

You are right @ollieatkinson. Many thanks.

I do have code coverage enabled. Using the derived data custom path my xctestrun file is located at /tmp/derivedData/Build/Intermediates/CodeCoverage/Products/Mytarget_iphonesimulator10.2-x86_64.xctestrun

Which has helped me realize that I can find the file just as fine without using the -IDEx flags nor the -derivedDataPath flag at: /Users/MyUser/Library/Developer/Xcode/DerivedData/MyApp-xxx/Build/Intermediates/CodeCoverage/Products/MyTarget_iphonesimulator10.2-x86_64.xctestrun

where MyApp-xxx is the name of the app followed by a long string of letters.

(using Xcode 8.2.1)

plu commented 7 years ago

Cool that you found a solution. Would be great to have this in the readme, seems to be a common pitfall you can hit.