我有一个应用程序,我想从内部测试应用程序中的各个ui元素。其目的是验证显示控件(如标签)是否显示它们应该显示的内容,并触发正确的结果。
我并不是说任何E2E测试(我将使用Appium进行测试),我正在寻找某种东西,允许我在我需要的状态下打开应用程序,并测试一个元素(如果它显示正确,并且它的行为正确--我可能会将这两个操作分成两个单独的测试)。
例如,:
- initial screen and check the "Hello" button is there
- initial screen and check that clicking on the "Hello" button opens new screen
- second screen and check that there is "Red" button
- second screen and check that upon clicking on "Red" button the screen turns red
- and so on..
我不知道如何称呼这种测试,但对我来说,这听起来像是"ui单元测试“
我知道这在使用Espresso的安卓系统上是可能的,所以我希望这在iOS上也是可能的。
发布于 2015-10-16 21:30:29
您看过Xcode 7中的新UI测试工具(XCUITest)吗?有了它,您肯定能够检测UI元素的存在,并对它们进行操作(例如点击按钮)。但是,我不确定是否能够确认背景视图的颜色是否发生了变化,除非您将视图的UIAccessibility值设置为包含颜色信息。
UI测试概述:https://developer.apple.com/videos/play/wwdc2015-406/潜在限制:https://medium.com/@larcus94/ui-testing-with-xcode-7-221d16bad276
https://stackoverflow.com/questions/32999726
复制相似问题