gpt4 book ai didi

XCode UI 测试因 'incomplete metadata' 而失败

转载 作者:行者123 更新时间:2023-12-03 17:18:27 27 4
gpt4 key购买 nike

我正在尝试为我的 cocoa macOS 应用程序运行 UI 测试。但是,当运行以下测试来检查应用程序的启动性能时,测试每次都会失败:

func testLaunchPerformance() throws {
if #available(macOS 10.15, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) {
XCUIApplication().launch()
}
}
}

打印以下错误消息。我猜这是说我的应用程序在应用程序的多次启动之一中没有完整的元数据?!

2020-05-07 10:15:44.666665+0200 SkipItUITests-Runner[6288:100036] *** Assertion failure in -[SkipItUITests.SkipItUITests measureWithMetrics:options:block:], /Library/Caches/com.apple.xbs/Sources/XCTest/XCTest-16091/Sources/XCTestFramework/Core/XCTestCase.m:1280
t = 12.68s Assertion Failure: SkipItUITests.swift:38: failed: caught "NSInternalInconsistencyException", "Iteration with index 1 doesn't have complete metadata. metricIdentifier: com.apple.dt.XCTMetric_OSSignpost-ApplicationLaunchExtended.duration metricDisplayName: OS Signpost Duration (ApplicationLaunchExtended) measurementForIteration: (null)"
(
0 CoreFoundation 0x00007fff34c91d07 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff6d9b55bf objc_exception_throw + 48
2 CoreFoundation 0x00007fff34cbaec8 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff373a5f3d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 XCTest 0x0000000100275b0f -[XCTestCase measureWithMetrics:options:block:] + 3518
5 XCTest 0x0000000100274d28 -[XCTestCase measureWithMetrics:block:] + 111
6 SkipItUITests 0x0000000103ac5156 $s13SkipItUITestsAAC21testLaunchPerformanceyyKF + 422
7 SkipItUITests 0x0000000103ac539a $s13SkipItUITestsAAC21testLaunchPerformanceyyKFTo + 74
8 CoreFoundation 0x00007fff34bf7a6c __invoking___ + 140
9 CoreFoundation 0x00007fff34bf7911 -[NSInvocation invoke] + 303
10 XCTest 0x0000000100270f02 __24-[XCTestCase invokeTest]_block_invoke_3 + 52
11 XCTest 0x0000000100338ec1 +[XCTSwiftErrorObservation observeErrorsInBlock:] + 69
12 XCTest 0x0000000100270e04 __24-[XCTestCase invokeTest]_block_invoke_2 + 119
13 XCTest 0x00000001002fea3a -[XCTMemoryChecker _assertInvalidObjectsDeallocatedAfterScope:] + 51
14 XCTest 0x000000010027c696 -[XCTestCase assertInvalidObjectsDeallocatedAfterScope:] + 116
15 XCTest 0x0000000100270d5e __24-[XCTestCase invokeTest]_block_invoke.206 + 213
16 XCTest 0x00000001002e6563 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 69
17 XCTest 0x00000001002e6474 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 115
18 XCTest 0x00000001002707f4 -[XCTestCase invokeTest] + 1144
19 XCTest 0x000000010027214f __26-[XCTestCase performTest:]_block_invoke_2 + 43
20 XCTest 0x00000001002e6563 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 69
21 XCTest 0x00000001002e6474 -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 115
22 XCTest 0x0000000100272086 __26-[XCTestCase performTest:]_block_invoke.366 + 86
23 XCTest 0x00000001002f650e +[XCTContext runInContextForTestCase:block:] + 211
24 XCTest 0x000000010027193a -[XCTestCase performTest:] + 566
25 XCTest 0x00000001002c53f5 -[XCTest runTest] + 57
26 XCTest 0x000000010026bc9b __27-[XCTestSuite performTest:]_block_invoke + 354
27 XCTest 0x000000010026b424 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 24
28 XCTest 0x00000001002f650e +[XCTContext runInContextForTestCase:block:] + 211
29 XCTest 0x000000010026b3db -[XCTestSuite _performProtectedSectionForTest:testSection:] + 148
30 XCTest 0x000000010026b709 -[XCTestSuite performTest:] + 348
31 XCTest 0x00000001002c53f5 -[XCTest runTest] + 57
32 XCTest 0x000000010026bc9b __27-[XCTestSuite performTest:]_block_invoke + 354
33 XCTest 0x000000010026b424 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 24
34 XCTest 0x00000001002f650e +[XCTContext runInContextForTestCase:block:] + 211
35 XCTest 0x000000010026b3db -[XCTestSuite _performProtectedSectionForTest:testSection:] + 148
36 XCTest 0x000000010026b709 -[XCTestSuite performTest:] + 348
37 XCTest 0x00000001002c53f5 -[XCTest runTest] + 57
38 XCTest 0x000000010026bc9b __27-[XCTestSuite performTest:]_block_invoke + 354
39 XCTest 0x000000010026b424 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 24
40 XCTest 0x00000001002f650e +[XCTContext runInContextForTestCase:block:] + 211
41 XCTest 0x000000010026b3db -[XCTestSuite _performProtectedSectionForTest:testSection:] + 148
42 XCTest 0x000000010026b709 -[XCTestSuite performTest:] + 348
43 XCTest 0x00000001002c53f5 -[XCTest runTest] + 57
44 XCTest 0x00000001003117dd __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 171
45 XCTest 0x00000001003118c3 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke.100 + 96
46 XCTest 0x000000010029351b -[XCTestObservationCenter _observeTestExecutionForBlock:] + 692
47 XCTest 0x0000000100311567 -[XCTTestRunSession runTestsAndReturnError:] + 615
48 XCTest 0x000000010024ee36 -[XCTestDriver runTestsAndReturnError:] + 458
49 XCTest 0x00000001002f2231 _XCTestMain + 2485
50 SkipItUITests-Runner 0x0000000100001dba _XCTRunnerRunTests + 258
51 SkipItUITests-Runner 0x0000000100001cb8 _XCTRunnerRunTests + 0
52 libdyld.dylib 0x00007fff6eb5ccc9 start + 1
)
t = 12.79s Tear Down
Test Case '-[SkipItUITests.SkipItUITests testLaunchPerformance]' failed (12.792 seconds).
Test Suite 'SkipItUITests' failed at 2020-05-07 10:15:44.831.
Executed 1 test, with 1 failure (1 unexpected) in 12.792 (12.793) seconds
Test Suite 'SkipItUITests.xctest' failed at 2020-05-07 10:15:44.831.
Executed 1 test, with 1 failure (1 unexpected) in 12.792 (12.793) seconds
Test Suite 'Selected tests' failed at 2020-05-07 10:15:44.832.
Executed 1 test, with 1 failure (1 unexpected) in 12.792 (12.794) seconds

如何修复测试用例以使其成功?

最佳答案

好吧,显然我的项目设置有问题。我创建了一个新项目并将文件复制到新项目中,现在 UI 测试已经运行完毕。

关于XCode UI 测试因 'incomplete metadata' 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61653138/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com