• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Automated unit-testing for iOS?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automated unit-testing for iOS?


  • Subject: Automated unit-testing for iOS?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 01 Sep 2011 13:05:47 -0700

OK, this should be something easy and supported, but I can’t get it to work and can’t find docs on how to do it, so either I’m dumb or no one else cares about running unit tests on their continuous-build server…

- We have an iOS library (Couchbase Mobile).
- We have a minimal app that runs it, and a separate unit-test target that runs tests in the simulator.
- All this was easy to set up in Xcode 4 and works great.

- Our QA guy has automated builds set up in our Jenkins-based buildbot server (running ‘xcodebuild’.)
- We also want the buildbot to run the unit tests, so it can turn the magic light red when the tests fail, and more usefully, block the code review system (Gerrit) from accepting the patch into trunk.

All this is textbook agile-programming stuff, right? And yet I cannot figure out how to run the unit tests in an automated way. My co-worker has even proposed AppleScripting Xcode to choose the “Test” menu command … but I really don’t want to go down that road.

Here’s what I’ve got:
Xcode appears to run tests by invoking the shellscript /Developer/Tools/RunUnitTests. This in turn requires about a dozen environment variables to be set up, so I wrote a wrapper script that sets all of those first. Now the error I get is:

/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/Tools/RunPlatformUnitTests:95: warning: Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set).

…which is a lie, because the simulator runs this same test bundle perfectly fine when Xcode tells it to.
If I don’t set the TEST_HOST variable, so the tests will be treated as “logic” instead of “hosted”, I instead get the error

otool: can't open file: /Developer/usr/bin/otest (No such file or directory)

I’ve found some old blog posts that predate Xcode 4, and some questions on StackOverflow that have answers recommending I hack changes into RunPlatformUnitTests to take out that check for the simulator. I’d really rather not do that.

So please tell me that this is actually easy and I just missed the obvious documentation?

—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Automated unit-testing for iOS?
      • From: Chris Hanson <email@hidden>
    • Re: Automated unit-testing for iOS?
      • From: Thomas Engelmeier <email@hidden>
    • Re: Automated unit-testing for iOS?
      • From: Eric Wing <email@hidden>
  • Prev by Date: Re: Unwanted ppc build
  • Next by Date: Re: Unwanted ppc build
  • Previous by thread: Re: Clang, scan-build and xcodebuild
  • Next by thread: Re: Automated unit-testing for iOS?
  • Index(es):
    • Date
    • Thread