

IOS Integration Testing by Square - sahillavingia
http://corner.squareup.com/2011/07/ios-integration-testing.html

======
angerman
Ok, this might be somewhat dumb; I'm just starting to get into testing. How
does KIF[1] compare to Kiwi[2]?

\--

[1]: [http://corner.squareup.com/2011/07/ios-integration-
testing.h...](http://corner.squareup.com/2011/07/ios-integration-testing.html)

[2]: <http://http://www.kiwi-lib.info/>

~~~
spindel
Kiwi is for unit testing, KIF is for integration testing. They don't do the
same thing (nor try to). Since you said you're just starting to get into it,
here's what that means:

Integration tests simulate a user using your app - tapping on controls,
manipulating views, typing in text, etc (see the video in the blog post). As
these steps run you have simple tests to make sure the app is behaving as you
expect it to.

Unit tests exercise more discrete things like model objects, controller logic,
validations. Tons of small tests like "when we add these money values
together, is the sum what we expect?".

At Square we use KIF for integration tests and GHUnit for unit tests. We run
both on a continuous integration system (CruiseControl.rb) that runs the tests
whenever we push new code.

------
Klonoar
The best thing I got out of this is that I discovered Square's GitHub
account... with an astonishing _65_ repositories. I already held Square in
high regard; this just icing on the cake.

~~~
rafaelc
Project followers might be a more relevant metric for impact than the number
of repo's

~~~
cachemoney
Indeed. I have over a hundred repos, and I'm useless ;)

------
maximilianburke
Semi-related, does anyone perform automated unit test deployment, execution,
and reporting on iOS devices? If so, how do you do it?

At my current company we have a rather large automated test infrastructure
that builds and runs ~50 or so individual libraries and their associated unit
test programs on around 20 different configurations for 10 different
platforms. Most of these platforms have a way of doing an unattended
deployment of our test programs (and associated data) to the device, execute
the programs, and retrieve the output.

This isn't working on iOS though because of its dependency to Xcode. We've
tried scripting Xcode with AppleScript but this is fragile and routinely
breaks.

Has anyone tackled this problem and succeeded?

~~~
pkaler
Yup. I've setup a Jenkins server that uses a combination of xcodebuild and
xcrun. The process:

    
    
      - clones the repo from git
      - builds with xcodebuild
      - signs/provisions with xcrun
      - creates a manifest file for over-the-air installs
      - copies the build to a server where users can install
      - saves off the symbol file for our crash server so it can symbolicate crashes
      - sends emails
    

It would run unit tests and integration tests if we had them. :)

~~~
maximilianburke
Thanks for the xcrun hint! Does that still handle the application/data
deployment and execution, or does it just automate the packaging? All the
information I can gather about doing OTA deployment points to still requiring
the user to initiate the download, and then run it. I'd like to avoid that if
possible because of the sheer number of libraries we need to test.

------
puls
Any questions? We'll be around to answer them.

~~~
ecito
How hard would it be to add gesture support? double tap here, swipe left
there, etc.

Are accessibility labels the only way to reference views?

~~~
puls
Indeed, accessibility labels are the only way to reference views. Granted,
your tests are running within your process, so they sky is pretty much the
limit.

We're still considering the best way to implement gestures. There's some
rudimentary support, but it's incomplete right now. Your input is welcome!

------
dominostars
Thus far, my team has likewise been unable to find a good functional testing
suite for iOS. We will definitely be giving this a shot.

------
falava
A nice collection of iOS testing posts:

[http://softnoise.wordpress.com/2010/11/14/ios-setting-up-
a-t...](http://softnoise.wordpress.com/2010/11/14/ios-setting-up-a-test-
environment/)

------
SeoxyS
Wow! I think I just came.

Seriously, unit testing in iOS is not great, and this kind of simulation is
exactly what we need. Regular unit tests are great for model-layer stuff and
data-processing code, but they will not help with most real-world problems
that occur.

"Does my login flow still work?" and "Can I still use every feature of my app
successfully?" is the kind of thing you need to know after committing code.

------
netpenthe
how does this compare with selenium ?

