At Whole Punk, we’re working on a new product that removes an awful lot of the grunt work from UI testing. We’re using UIAutomation to build full state graphs of the UI, and then generating a pretty doc of all the screenshots and crashes we detect.
It’s a brute force approach – it takes hours for a mid sized app or days for a large one. But who cares? I’m happy to have a computer do a days worth of work so I can spend ten minutes reviewing the UI for unexpected display bugs.
The alternative is that I’d do the work myself. I’m also thrilled to have a computer in charge of finding the low-hanging crashes and handing me reproduction scripts. Most companies we deal with hand this sort of testing off to an intern. We think a computer is faster, more comprehensive, and ends up giving better data.
Enough with the sales pitch.
In order to do this testing, we need to be able to run UIAutomation scripts via instruments. One of the restrictions we ran into is that we can only run UIAutomation scripts on apps that are signed with our development profile.
Since our ambition is to run this as a service, we needed a way to resign apps with our development profile. The answer turns out to be pretty simple:
/usr/bin/codesign -f -s “YOUR_DEVELOPMENT_CERT_NAME” —resource-rules APP_PATH/ResourceRules.plist —entitlements ENTITLEMENTS_PATH APP PATH
The entitlements file should contain the following:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
And voila, we can run UIAutomation against apps we didn’t build.