开发者

XCode4 Unit Testing and UIAutomation

开发者 https://www.devze.com 2023-02-21 19:15 出处:网络
I\'m looking to set up testing at my company, but I\'m a little fuzzy on the best way to start. I know that I can use a framework for unit testing, such as OCUnit, GHUnit or SenTestingKit... so far s

I'm looking to set up testing at my company, but I'm a little fuzzy on the best way to start.

I know that I can use a framework for unit testing, such as OCUnit, GHUnit or SenTestingKit... so far so good. I can make a target which logic tests my project, using Mock objects etc.

I'm also aware of using UIAutomation and javascript to drive and test the GUI.

So, now if I implement a fairly complex GUI开发者_开发知识库 feature, I would like to logic test my code and also test the GUI using UIAutomation. How do I combine these two methodologies, or are they to be treated separately, in which case am I to assume that I need to write two sets of tests in two different languages to fully test one feature?

On a side-note, if anybody can provide good links for advice on beginning testing on an already mature and not-so-modular codebase, that would be much appreciated.

Thanks!


UIAutomation is JavaScript based. Test cases are collections of JavaScript files, which are later executed by Instruments.

Yes you have to do that seperately:

  1. It is a complete different language (JS)
  2. It is not executed on Xcode-Build but by Instruments
  3. GUI tests have a different test scope from unit or logic test. Even if there are some similarities with logic tests. It is also tested, if the GUI "behaves" correctly.

This video might help you. Take an hour and afterwards you should be able to decide on your own (the UIAutomation session).

http://developer.apple.com/videos/wwdc/2010/

By the way: There is no satisfying way to automate UIAutomation tests at the moment (For logic and unit tests, there are some). For example to combine them with Continuous Code Integration. There are discussions about that, but I have not seen a solution so far. All in all you can play a little with that, but for serious testing UIAutomation is still not applicable:

  1. No test automation
  2. No separation of test cases. If one case fails within your choreography, all following test might be useless.
0

精彩评论

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