Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 用截图测试用户界面_Xcode_Xcode9_Xcode Ui Testing - Fatal编程技术网

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
文件夹中找到所有测试结果。这还包括屏幕截图