If, like me, you have always been quite doubtful about ios UI automated tests, you can rejoice because the new framework zucchini is a great tool for the job.
While I tried calabash, it just didn't workout but this will be described in another post.
Given that you installed homebrew, the setup of zucchini is pretty straightforward.
don't forget the
-g option to
npm install otherwise it will be a local installation.
Setting up a simple XCode project
Create a basic master/view application for ios.
Create the zucchini hierarchy
Zucchini uses the files located in a specific folder (usually called
features). The config file is located in
features/support/config.yml and all other tests scenario are located in
features/other-folders where other-folders is anything but support.
features/support/confing.yml and write
screen parameter will be used both as the default mask name and the folder where to write the test scripts.
Writing your first script
Because, at the time of this writing, zucchini is not yet fully compliant with ios7, a few more steps are required to complete the setup.
As mentioned in the previous section the folder
reference/retina_ios7 will be used by zucchini as the reference folder where it will compare the screenshots taken by the application and the one the application should look like.
Next step, edit the
features/simple-test/feature.zucchini file and write
That's it you can now run
zucchini run features and it should now work.
Working with masks
Masks are very important when you use zucchini, because eventually, zucchini will compare you app with different screenshots taken.
If you omit the default one, you will see a failed test with a diff looking like this:
An easy fix for this is to get a simple mask with a black rectangle where the status bar is located.