Is there a way to restart the app before every test?

912 views
Skip to first unread message

Ru Cindrea

unread,
Oct 3, 2013, 8:44:48 AM10/3/13
to kif-fr...@googlegroups.com
Hello, 

I would like to know if with this latest version of KIF there is a way to restart my application under test before every test starts. I know I could this in the "before each" function, but I don't really have any idea what exactly to use inside the function. 

Thanks, 
Ru

Brian Nickel

unread,
Oct 4, 2013, 12:10:30 AM10/4/13
to kif-fr...@googlegroups.com
The problem you would face with this is that KIF, along with every other testing suite I've seen (MonkeyTalk, Frank, even UIAutomation) are hosted within or attached to the app itself after the app starts.  KIF uses OCUnit, which is executed by the app loading its bundle after launch.  What this boils down to is, if the app stops, the tests stop with it.

The good news, if you have an unlimited amount of time to start probing, is that OCUnit can be controlled by command line options.  You could come up with a script that looks like this:

    1. Somehow get the list of test classes and methods.  Xcode is great at this, there may be a method exposed.
    2. For each test method, run xcodebuild test ... with whatever flag is required to pass -SenTest TestClassName/testName into the command line arguments.
    3. Filter the logs if necessary. You should probably just be able to take these logs and pass them through whatever existing reporting mechanism you have.

It'll be some degree of research and hassle, but it could work.

Brian
Reply all
Reply to author
Forward
0 new messages