hqfking
hqfking

Reputation: 11

Different test results from Instrument and command line

I have a automated test script written in UIAutomation. If I run it from the Instrument, all tests are passed. If I run it from the command line, one of the test case will fail and result in the termination of test script running.

The failing test case is about triggering a UIAActivityIndictor and then show an Alert window.

I did some search online, and people are saying that the command line is faster than the Instrument. Sometimes, you need to make sure the UIAElement is valid. However, in my case, at that test case, it seems the command line lost the UIAElements hierarchy of the app. The result of logElementTree is only the target and the app, no window at all. And the UI seems frozen.

Any suggestions would be helpful.

Upvotes: 1

Views: 93

Answers (1)

Sofa
Sofa

Reputation: 319

I faced with similar issues. When UI is completely frozen it means that application has been put in infinite loop. In my case NSLog with huge output was the cause. To check that: 1) put really big sleep at some point in your script 2) run the script 3) attach xcode to the app: debug->attach to a process->your app's process 4) wait until freeze happen. Make sure of it manually 5) in xcode press pause execution 6) now you can see in stacktrace where the app is hanging

Upvotes: 1

Related Questions