开发者

Are there any existing library for Automation of UI controls in IOS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_开发知识库

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

I am very new to IOS programming. I have a task to find if I can automate my UI for testing. This is what I want to do:

  • Put some code in my application that randomly (sounds bad but may be pre-defined events)sends event messages to controls on the screen.

  • Since it is just code I should be able to take the app, deploy it in any iPhone or iPad and run the program.

  • Once the app is completely automated by my code I guess it will be easy to do the analytics on the obtained performance data.

I have seen FoneMonkey but looks like it needs user interaction recorded manually on each device.

Any thoughts or suggestions are welcome.

  • Lalith


Hello Lalith i have been creating some UI Automation tests for an application and its working very well. Although it has some tricks, I think you should take a look at these links:

http://answers.oreilly.com/topic/1646-how-to-use-uiautomation-to-create-iphone-ui-tests/

http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/

If you need more help, just let me know. :)

Edit1:

On your viewDidLoad of your viewController you can add something like this:

   - (void)viewDidLoad {
        [super viewDidLoad];
        //(Your code...)
        // I set it to start after 5 seconds...
        [self performSelector:@selector(startTest) withObject:nil afterDelay:5];
     }


   -(void)startTest{
      //took this from the link you posted
      [myButton sendActionsForControlEvents:UIControlEventTouchUpInside];
    }

Edit 2:

if([myTextField canBecomeFirstResponder]){
    [myTextField becomeFirstResponder];
}


Apple has a framework for javascript-based automation via instruments and the accessibility APIs. It's not 100% awesome the best, but it's worth taking a look.

Instruments + actually touching the phone with your finger is a pretty good way to do performance analysis "in the real world" as well.

Generally, I haven't found it worthwhile to automate UI testing. The UI generally changes too much to make a functional spec less work than it's worth. YMMV.


Once you get to a point you are comfortable, I would look at this KIF framework.

KIF, which stands for Keep It Functional, is an iOS integration test framework. It allows for easy automation of iOS apps by leveraging the accessibility attributes that the OS makes available for those with visual disabilities.


You could create a parent UIView, to which you add "children" or subviews. The subviews contain your application UI.

The parent view is set up to be transparent, and it captures touches and logs them. Once logged, the touch event is passed down to the subviews. You could send your test touches here.

Because the parent view is transparent, the user never sees it, but it still captures and processes touch events.

Setting this up would involve a fair amount of subclassing, and some classes (such as UIWebView) introduce difficulties. But it might be feasible.


Thanks for all your help. As I have mentioned in a comment that I should be able to run them in IOS device as stand alone. We can use sendActionsForControlEvents as described here . This is all I need for now.


You can consider SeeTest from Experitest, it comes with very easy record and replay capabilities.


I've been using IMAT quite successfully for iOS automation.

https://code.intuit.com/sf/sfmain/do/viewProject/projects.ginsu

Reasons I like it:

  1. It's built right on top of the javascript automation that Apple provides and you can kick it off from Instruments or command line
  2. It provides a test-runner (think N-Unit) for javascript iOS automation
  3. Provides a neat mechanism for retrieving UI Elements (similar to an object map used by other automation tools)
  4. Requires no changes to your app code (no need to build with a certain library or instrument your code)
  5. Provides a jUnit like report after a test run by reading the plist file and this is picked up by my CI Tool (Teamcity, Jenkins, CruiseControl)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜