在XCTest UI测试中,如何检查按钮,标签,视图的背景颜色? [英] In XCTest UI Testing, how to check the background color of button, label , views?

查看:137
本文介绍了在XCTest UI测试中,如何检查按钮,标签,视图的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试验证是否可以在XCTest UI测试中获得背景色,我希望将背景色与设置值进行比较,这样我就不必依靠图像比较了

I am trying to validate if the background color can be obtained in XCTest UI Testing, I am looking to compare the background color with the set value, so that i don't have to rely on image comparison

推荐答案

XCTest用于功能测试,而不是宣称视觉要求.

XCTest is for functional testing, rather than asserting visual requirements.

要测试诸如背景色之类的要求,请使用单元测试来初始化有问题的视图控制器,并在其中检查视图的背景色.您无需依赖图像比较,并且单元测试要快得多.

To test requirements such as background color, use a unit test to initialize the view controller in question and check the view's background color there. You don't need to rely on image comparison, and unit tests are a lot faster.

这篇关于在XCTest UI测试中,如何检查按钮,标签,视图的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆