Xcode 用截图测试用户界面
我正在尝试自动化我的测试一点。 我写了一个简单的测试,截图我的应用程序Xcode 用截图测试用户界面,xcode,xcode9,xcode-ui-testing,Xcode,Xcode9,Xcode Ui Testing,我正在尝试自动化我的测试一点。 我写了一个简单的测试,截图我的应用程序 func testiPhoneVariants() { let screenshot = XCUIScreen.main.screenshot() let attachment = XCTAttachment(screenshot: screenshot) attachment.lifetime = .keepAlways add(attachment) } 现在我想在多个模拟器上测试它,所
func testiPhoneVariants() {
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways
add(attachment)
}
现在我想在多个模拟器上测试它,所以我制作了命令行:
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
测试已经完成了,但是在哪里可以找到截图呢
谢谢
-Joseph在派生数据文件夹中将有一个.xActivityLog,通常位于以下路径: ~/Library/Developer/Xcode/DerivedData//Logs/Test/
在.xActivityLog文件中,将有一些对象包含屏幕截图文件的详细信息,包括它们的文件名。您还可以将
-resultBundlePath
传递到xcodebuild
命令,以指定测试结果的位置
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
您应该在test\u results
文件夹中找到所有测试结果。这还包括屏幕截图