Test - Sample Swift iOS App and Tutorials
Important
Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.
XCUITests are included with the sample app. In this tutorial, you'll learn to run the UI tests using App Center.
First, follow the getting started tutorial to set up the sample app.
- Provisioning Profile and Certificate. Go to the Apple Developer Documentation to learn about creating an App ID to codesign the sample iOS app with.
Install Node.js version 6.3 or later.
Open the terminal and run the command below to install the App Center CLI:
npm install -g appcenter-cli
Run the command below and follow the directions to log in to App Center:
appcenter login
Open a terminal and go to the project directory.
Run the command below to remove the derivedDataPath if it exists:
rm -rf ddp
Run the command below to make the build folder for tests:
xcrun xcodebuild build-for-testing -configuration Debug -workspace sampleapp-ios-swift.xcworkspace -sdk iphoneos -scheme sampleapp-ios-swift -derivedDataPath ddp
Go to the Test service in App Center.
Click on Start testing your app.
Select the first device, the Apple iPhone 7 Plus, and press Select one device at the bottom.
Choose XCUITest as the Test framework.
Click Next.
Copy the custom command under Running tests.
Paste it into the terminal while in the project directory.
Replace
pathToXCUItestBuildFolder
with the text below:ddp/Build/Products/Debug-iphoneos
Run the command. You'll see the tests begin to run.
In App Center, click Done to close the panel.