What is the best design pattern for XCUITest?

Hi all,

I am new in XCUITest, and I am searching the best pattern to organize my test.

I already read about Page Object and work with enumeration. But what is the best way?

Are there examples?


Many thanks!

Replies

First, understand the testing pyramid.

in order of speed: unit tests, non ui integration tests, ui integration tests (XCUITest)


Second,

I would argue that using the PageObject design pattern is obsolete as far as XCUITest is concerned. Your xcuitest should probably just be doing a short tour of a feature's happy path, and not verifying button presence. You should only ever verify something if your test requires it to appear.


Third,

If you are concerned with validating that your buttons and views appear and work correctly you should be using Apple's new Swift Previews to ensure your application works: https://developer.apple.com/videos/play/wwdc2019/233/

I strongly recommend watching this video as an Apple dev builds up an awesome UI validation tool for a view.

Well, Page Object pattern is not about "verifying button presence". It's about separation logic of the test and locators on the "page" view. I also come to the forum to find best practices, it seems it still works fine for the apps with the user interface with different "pages" aka "activity views" for Android platform.