首页 > 解决方案 > xcodebuild error DVTAssertions: ASSERTION FAILURE while execution single command line test,但所有测试用例命令工作正常

问题描述

我可以通过以下命令使用 XCUItest 执行我的项目:

xcodebuild test -workspace Maple.xcworkspace -scheme Maple -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 
8,OS=11.4'

该命令运行良好,并且我的所有测试用例都运行。

我想执行一个 .swift 文件。所以我使用了以下命令:

xcodebuild test -workspace Maple.xcworkspace -scheme Maple -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.4' -only-testing:/Users/amit.jathar/Maple/MapleUITests/DashboardTests.swift

上面的命令抛出以下错误:

命令行中的用户默认值:IDETestRunOnlyIdentifiers = ("Maple/MapleUITests/DashboardTests")

--- xcodebuild:警告:无法在工作区“Maple.xcworkspace”中打开项目文件“/Users/amit.jathar/sdm-maple-ios/MaplePlayground.playground”。

2018-07-12 17:44:55.000 xcodebuild[13879:5394085] [MT] DVTAssertions:/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-14161/IDEFoundation/Execution/Schemes/IDETestSchemeAction 中的断言失败.m:272

详细信息:(anyTestRunSpecification) 不应为零。对象: 方法:-testOperationWithSchemeOperationParameters:testManager:withBuildOperation:buildParameters:schemeCommand:actionRecord:testRunSpecifications:deviceAvailableChecker:outError:actionCallbackBlock: 线程: {number = 1, name = main} 提示:

回溯: 0 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:](在 DVTFoundation 中)1 _DVTAssertionHandler(在 DVTFoundation 中)2 _DVTAssertionFailureHandler(在 DVTFoundation 中)3 -[IDETestSchemeAction testOperationWithSchemeOperationParameters:testManager:withBuildOperation:buildParameters:schemeCommand :actionRecord:testRunSpecifications:deviceAvailableChecker:outError:actionCallbackBlock:] (在 IDEFoundation 中)4 -[IDEScheme _executionOperationForSchemeOperationParameters:build:onlyBuild:buildParameters:title:buildLog:dontActuallyRunCommands:restorePersistedBuildResults:deviceAvailableChecker:error:actionCallbackBlock:] (在 IDEFoundation 中)5 -[ IDEScheme schemeOperationForSchemeOperationParameters:buildLog:overridingProperties:overridingBuildConfiguration:dontActuallyRunCommands:restorePersistedBuildResults:deviceAvailableChecker:error:completionBlock:](在 IDEFoundation 中)6 -[IDEScheme schemeOperationForSchemeOperationParameters:buildLog:overridingProperties:overridingBuildConfiguration:dontActuallyRunCommands:restorePersistedBuildResults:error:completionBlock:](在 IDEFoundation 中)7-[Xcode3CommandLine:(在 XcodeSection3_build]WithTimingSection ) 8 -[Xcode3CommandLineBuildTool run] (在 Xcode3Core 中) 9 main (在 xcodebuild 中) 10 start (在 libdyld.dylib 中) 中止陷阱:6](在 IDEFoundation 中)7 -[Xcode3CommandLineBuildTool _buildWithTimingSection:](在 Xcode3Core 中)8 -[Xcode3CommandLineBuildTool 运行](在 Xcode3Core 中)9 main(在 xcodebuild 中)10 start(在 libdyld.dylib 中)中止陷阱:6](在 IDEFoundation 中)7 -[Xcode3CommandLineBuildTool _buildWithTimingSection:](在 Xcode3Core 中)8 -[Xcode3CommandLineBuildTool 运行](在 Xcode3Core 中)9 main(在 xcodebuild 中)10 start(在 libdyld.dylib 中)中止陷阱:6

标签: xctestxcodebuildxcuitest

解决方案


推荐阅读