我可以使用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-[Xcode3CommandLineBuildTool _buildWithTimingSection:](在Xcode3Core中) 8-[Xcode3CommandLineBuildTool运行](在Xcode3Core中) 9主(在xcodebuild中) 10开始(在libdyld.dylib中) 中止陷阱:6