Testing in iOS - Part 26: Queries | Ray Wenderlich

Queries are used to fetch items like navigation bar and buttons. This video covers the process on how it works.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3530-testing-in-ios/lessons/26

Thank you so much for putting these UI Testing videos together! I’ve tried many times to get in to UI testing, but this is the only tutorial that explained every piece I was missing.

1 Like

Awesome - I’m glad they helped you out. I really like the way Apple has setup UI testing. It’s actually pretty fun. Fastlane even uses UI testing to automate screenshots as well. In any case, thanks for the nice note!

Awesome series! It’s like drinking water from a firehose on this topic. I’m not able to get the coverage to display for the app on Lesson 26. I can get to the screen where I click the coverage tab, but nothing shows up. I can see the individual tests that pass, but the coverage does not display. What do I need to click sequentially to get that?

Seeing the code coverage is something that you must opt into. To enable it, click on the Edit Scheme button and select the test configuration. In the info section of the dialog, just click the Gather coverage data and you’ll be off and running.

09 AM

I hope that helps!

Fyi - I believe I do “cover” this (excuse the pun) in the video about code coverage (in case you want to see it in action). Cheers!

One thing that I thought was interesting in this lesson was the deferred execution of the query

In

let display = app.staticTexts.matching(identifier: "result").firstMatch

the display constant does not yet have the result of the query execution. It gets the UIElement only when the query is executed when you do display.label. I found this out because I was trying to troubleshoot my UI Test and when the breakpoint was set before the XCTAssert statement, the display constant did not have the value I expected.

I’m with the same problem, you solve?

@feimamura Do you still have issues with this?