I am trying to automate my testing a little. I wrote a simple test that takes a screenshot of my app
func testiPhoneVariants() {
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways
add(attachment)
}
Now I wanted to test it on multiple simulators, so I made the command line:
xcodebuild -workspace MyProject.xcworkspace -scheme MyProjectUITests \
-destination 'platform=iOS Simulator,name=iPhone SE' \
-destination 'platform=iOS Simulator,name=iPhone 7' \
-destination 'platform=iOS Simulator,name=iPhone 7 Plus' \
-destination 'platform=iOS Simulator,name=iPhone X' \
test
The tests run through, but where can I find the screenshots?
Thanks - Joseph
You can also pass the -resultBundlePath
to the xcodebuild
command to specify where you want the test results to be.
xcodebuild -workspace MyProject.xcworkspace -scheme MyProjectUITests \
-destination 'platform=iOS Simulator,name=iPhone SE' \
-destination 'platform=iOS Simulator,name=iPhone 7' \
-destination 'platform=iOS Simulator,name=iPhone 7 Plus' \
-destination 'platform=iOS Simulator,name=iPhone X' \
-resultBundlePath test_results \
test
You should find in all your test results in the test_results
folder. That also includes screenshots