I am currently automating our iOS testing on jenkins. So far I had no problems with running unit tests, converting OCUnit into JUnit and generating code coverage in Cobertura format (lots of googling but no hard problems).
However, when creating UIAutomation job, I am stuck. The tests are running successfully (calling instruments
from command line). Generating junit report was tricky but possible.
The problem is that when running UIAutomation, no code coverage files are generated.
Is there a possibility to generate them? If not, could you please explain why?
What I tried so far:
- Attaching UIAutomation to an already running application on iOS simulator.
- this seems impossible. Either the running application is killed by instruments and a new instance is relaunched or a cryptic error message is printed.
- Quit simulator at the end of js script using a combination of osascript and
UIAHost. performTaskWithPathArgumentsTimeout
.- application ended gracefully but no coverage generated.
Edit
After some testing with a different framework I realized it's not enough to quit the simulator, you have to explicitely call exit()
from the application. With UI Automation this is a bit tricky but you can declare an applicaton scheme, e.g. my-app://exit
and call it through MobileSafari using UIAHost.performTaskWithPathArgumentsTimeout
. Will check whether this is enough for the files to be generated.