Documentation for Xcode UI Testing?

Hello Everyone!


This feels really stupid, but I'm really stuck... Is there any documentation for the new Xcode 7 UI Testing? I really can't find it.


Thanks!

Really wish I could find some documentation on this subject too 😟

Only what I've seen in the https://developer.apple.com/xcode7-beta-release-notes



UI Testing

User interface testing and recording. Test applications at the user interface surface with elements, queries, and simulated events. The UI recording feature enables capture of UI actions into source to facilitate creating tests.

  • Xcode 7 introduces UI testing as a major new feature of the existing XCTest framework. UI testing is implemented as an extension to the existing APIs and concepts in XCTest, making it easy to adopt for developers who have familiarity with Xcode’s testing features. (10975541)
  • Code coverage does not work with UI testing.
  • UI testing cannot identify elements using information from their accessibility title element. (20409319)

Workaround: Set an accessibility identifier instead.

UI testing may fail to find elements with names containing decomposable Unicode characters. (20804391)

  • Workaround: Use NSPredicate to explicitly match against key paths including precomposedStringWithCanonicalMapping, e.g.

title.precomposedStringWithCanonicalMapping.

  • UI testing cannot record or interact with popovers on OS X. (21162677)
  • Recording UI tests do not work if the device or simulator is in landscape orientation. (21096781) • UI tests do not support key modifiers on iOS. (21033224)
  • Auto-correct interferes with UI tests that type text, making results unpredictable. (21106884)

    Workaround: Disable auto-correct on devices and simulators used for UI testing.

  • The “Record UI Test” button sometimes causes Xcode to hang if the applications is not already running. (21224350)

    Workaround: Launching the application before clicking the “Record” button should resolve this.

  • The “Edit ▸ Convert ▸ To XCTest...” command will fail with an error that SenTestingKit.framework cannot be found. (21251738)


◅▻

If you haven't watched the UI Testing session at https://developer.apple.com/videos/wwdc/2015/?id=406 yet, that's definitely worth your time.

Yeah same here, just started using it and not sure how to do a lot of things other than use the record button.



Would love to know how to wite a test that waits for a network request to finish

Lucky me i had watched that . But im experiencing multiple questions when it gets to details. I think some kind of reference like it was with UI Automation will be very helpful

You shouldn't be testing with the network, you should be mocking it. You cannot guarantee that the network will be available or the server on the other end when you run your tests, so your tests are never deterministic.

What I've been doing is creating a mock web service with my expected result for a request, serializing the object and passing that through to the UI Tests application launch arguments. Then in the actual code, I have a Resolver which if I'm running a UI Test deserializes any objects and assigns them to my properties.


That way I can make a UI Test return a 404, wrong JSON, bad JSON, whatever I want for any request. With no-need for an API to hit.


eg.


MyClass has a WebService property which is a WebServiceProtocol.
I have a TestWebService which is a WebServiceProtocol.


The UI Test serializes the TestWebService into the app.launchArguments
MyClass has a Resolve step which either creates a new WebService, or deserializes from the Launch Arguments.


The serialize/deserialize step is a bit of a pain, so I just wrote a framework for it, now my entire app uses it.


If there's a better way to do this for UI Testing, I'm all ears.

Someone has quite cleverly "extracted" some early documentation:


"One of the first things you might notice about the new framework is the lack of documentation. Neither iOS 9 nor Xcode 7 include any official docs on UI Testing. Luckily, most of the new

XCU*
classes have well commented header files. By using appledoc, I was able to pull these header files into an Xcode and Dash compatible docset. Just clone the repository and open up the file; your default documentation browser will add the new APIs.
"


He has put the resultant reference structure up on GitHub here:

joemasilotti.github.io/XCTest-Documentation/index.html


For the article in which he discusses UI Testing in Xcode 7:

masilotti.com/ui-testing-xcode-7/

Thanks for the mention! Here's an online-viewable version of the XCTest documentation.

Searching for such a framework before writing it on my own I found your reply.

Is there any chance to get access to this framework, or any blog post where you explain about?

Documentation for Xcode UI Testing?
 
 
Q