手动添加 XCAutoMationSupport.framework,位置在:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks
然后在 Framework Search Path 添加 $(PLATFORM_DIR)/Developer/Library/PrivateFrameworks
运行的时候报错,无法启动 app:Unable to update application state promptly for Application '
Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' started.
t = 0.00s Start Test at 2018-11-11 17:18:10.514
t = 0.05s Set Up
t = 0.06s Pressing Home button
2018-11-11 17:18:12.593909+0800 XCTestWDUITests-Runner[28587:386693] springApplication:nil
t = 62.09s Snapshot accessibility hierarchy for app with pid 25419
t = 62.19s Assertion Failure: XCTestWDMonkey.swift:23: Unable to update application state promptly for Application 'com.myApp.demo'.
t = 62.20s Tear Down
t = 62.20s Pressing Home button
t = 62.24s Pressing Home button
Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' failed (62.256 seconds).
Test Suite 'XCTextWDRunner' failed at 2018-11-11 17:19:12.770.
Executed 1 test, with 1 failure (0 unexpected) in 62.256 (62.258) seconds
Test Suite 'XCTestWDUITests.xctest' failed at 2018-11-11 17:19:12.771.
Executed 1 test, with 1 failure (0 unexpected) in 62.256 (62.260) seconds
Test Suite 'All tests' failed at 2018-11-11 17:19:12.771.
Executed 1 test, with 1 failure (0 unexpected) in 62.256 (62.269) seconds
LLVM Profile Error: Failed to write file "default.profraw": Permission denied
直接在 xcode 运行 XCTestWD 可以运行,但是执行脚本报错:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_XCElementSnapshot", referenced from:
objc-class-ref in XCTestWDAccessibility.o
l__CATEGORY_XCElementSnapshot_$_XCTestWDUITests in XCTestWDAccessibility.o
objc-class-ref in XCTestWDApplicationTree.o
objc-class-ref in XCTestWDXPath.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我执行的脚本:
xcodebuild -project XCTestWD.xcodeproj \
-scheme XCTestWDUITests \
-destination 'platform=iOS Simulator,name=iPhone XR' \
XCTESTWD_PORT=8001 \
clean test