7
votes

I am investigating how to use XCTest to close our automation test gap. From the developer document, I only see something like this:

xcodebuild test -project MyAppProject.xcodeproj -scheme MyApp

https://developer.apple.com/library/tvos/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/08-automation.html#//apple_ref/doc/uid/TP40014132-CH7-SW1

I would like to know if there is a way to run XCTest(UI test) against an archived build (.ipa)? or Can we just seperate the build and test so that we can build first and test against that build later?

Thanks

1
Dunno, but this sounds like a reverse of something that is possible: use Xcode Server continuous integration, which runs tests and produces archives with every build.rickster
Our case is we want to run the tests against the same code commit on multiple devices. So it does not make sense that we should build the app for each test run.zheng ma
CI isn't "build for every test", it's "run test suite for every build", and usually also "build for every commit / day / merge to master". And each integration can run the same tests on multiple devices.rickster
Thanks for the response. My use case is I want to decouple the build server and device management server, and I only need to run basic verification tests along with build process in simulator, this can be done easily. However, after that, I want to run more tests in the device management server with real connected devices, which means I want to run more tests after the build artifact generated. I am trying to figure out if it is possible to run the further test without build the app again.zheng ma
Is it possible to directly to use the .ipa generated in the build server to run more tests in the device manage server?zheng ma

1 Answers

0
votes

If you want to separate the build and test stages, you can use the xcodebuild flags build-for-testing (which builds a xctestrun file) and test-without-building (which runs it). You may want to build-without-testing to a generic device if you want the build-for-testing to be used on multiple devices.

Check out https://medium.com/xcblog/speed-up-ios-ci-using-test-without-building-xctestrun-and-fastlane-a982b0060676 for more details