XCode4 单元测试和 UI 自动化

发布于 2024-10-29 13:11:34 字数 430 浏览 6 评论 0原文

我希望在我的公司进行测试,但我对最佳开始方式有点模糊。

我知道我可以使用单元测试框架,例如 OCUnit、GHUnit 或 SenTestingKit...到目前为止一切顺利。我可以使用 Mock 对象等创建一个逻辑测试我的项目的目标。

我还知道使用 UIAutomation 和 javascript 来驱动和测试 GUI。

因此,现在如果我实现一个相当复杂的 GUI 功能,我想对我的代码进行逻辑测试,并使用 UIAutomation 测试 GUI。我如何结合这两种方法,或者将它们分开对待,在这种情况下,我是否假设我需要用两种不同的语言编写组测试全面测试一个功能?

顺便说一句,如果有人可以提供良好的链接来获取有关在已经成熟且不太模块化的代码库上开始测试的建议,我们将不胜感激。

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愿与i 2024-11-05 13:11:34

UIAutomation 基于 JavaScript。测试用例是 JavaScript 文件的集合,稍后由 Instruments 执行。

是的,您必须单独执行此操作:

  1. 它是一种完全不同的语言(JS)
  2. ,它不是在 Xcode-Build 上执行,而是通过 Instruments
  3. GUI 测试与单元或逻辑测试具有不同的测试范围。即使与逻辑测试有一些相似之处。它还会测试 GUI“行为”是否正确。

这个视频可能对你有帮助。花一个小时,之后您应该能够自己做出决定(UIAutomation 会话)。

http://developer.apple.com/videos/wwdc/2010/ way:目前还没有令人满意的方法来自动化 UIAutomation 测试(对于逻辑和单元测试,有一些)。例如,将它们与持续代码集成结合起来。有人对此进行了讨论,但到目前为止我还没有看到解决方案。总而言之,您可以稍微尝试一下,但对于严格的测试,UIAutomation 仍然不适用:

  1. 没有测试自动化,
  2. 没有测试用例的分离。如果您的编排中的一个案例失败了,那么接下来的所有测试可能都是无用的。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文