Xcode Tips 💡

The more you know... 😎

⬅️ Go Back

✏️ Contribute

Testing

Re-run your last test

Use ⌃⌥⌘G to re-run your last test. Jon Reid has a name for this making it easier to remember: “smash go!”

Source: Paul Hudson

Randomizing test order

Go to the Product menu, hold down , then click Test. Inside the Info tab, click Options then check Randomize Execution Order to run tests in a different order every time.

Source: Paul Hudson

Improving UI test reliability

You can disable or speed-up animations, and increase timeouts for waitForExistence().

Source: Jesse Squires

Testing in-app purchases

Make a new StoreKit Config File, and add your IAP. Now go to the Product menu, hold down , and click Run. From the Options tab of the window, change StoreKit Config, and now you’ll use the test IAP.

Source: Paul Hudson

UI testing cheat sheet

Here are some quick code snippets that help you solve a variety of common problems using Xcode’s UI testing system.

Source: Paul Hudson

How to Speed Up SwiftUI Development and Testing Using PreviewSnapshots

A quick guide on PreviewSnapshots, an open-source preview snapshot tool that can share configurations between Xcode previews and snapshot tests.

Source: DoorDash Engineering