abhishek saatal
abhishek saatal

Reputation: 315

In XCTest UI Testing, how to check the background color of button, label , views?

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

Upvotes: 10

Views: 8552

Answers (1)

Oletha
Oletha

Reputation: 7649

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.

Upvotes: 13

Related Questions