我目前正在为一个 iPhone 应用程序编写 UITests,并且当前使用 NSLog 在辅助方法中出现意外情况时进行打印,这会导致测试级别的错误断言,因此很清楚测试中发生错误的位置。然后我只是阅读日志以查看问题所在。有没有办法将其打印到测试报告中,以便我可以在所有测试运行后检查所有失败?现在唯一的日志结果是测试自动生成的结果(例如“Tap 'myButton' Button”或“Find: Elements matching typeButton”)
我很乐意做出任何必要的澄清。
最佳答案
首先,你可以检查一下你的
TestSummaries.plist file
产生于
/Users/username/Library/Developer/Xcode/DerivedData/project-name/Logs/Test/TestSummaries.plist
如果你在 xcode 中打开文件,你会看到所有的测试摘要,但有点无聊。您必须展开所有节点。但是你可以使用
xcpretty
只需在您的终端中使用此命令
xcodebuild test -project projectname -scheme schmefilename -destination 'platform=iOS Simulator,name=iPad 2' | xcpretty --report html --output outputfolderdestination/report.html
要安装 xcpretty,请使用以下命令
gem install xcpretty
关于ios - 打印到 Xcode (XCTest) UITest 报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38792298/