Description
Previous ID | SR-822 |
Radar | None |
Original Reporter | @sharplet |
Type | Bug |
Status | Closed |
Resolution | Done |
Environment
Mac OS X, swift DEVELOPMENT-SNAPSHOT-2016-02-25-a
Additional Detail from JIRA
Votes | 0 |
Component/s | Package Manager |
Labels | Bug |
Assignee | @ddunbar |
Priority | Medium |
md5: 92a350686a48551ca909301ff0e58d56
Issue Description:
Steps to Reproduce
Run the following commands:
$ swift build --init
$ swift build
$ swift test
Expected
Either for a default test to run, or some message describing what's expected.
Actual
The following error message is printed:
Usage: xctest [-XCTest All | <TestCaseClassName/testMethodName>] <path of unit to be tested>
Failure: No test bundle found at path `/path/to/swift-testing/.build/debug/Package.xctest`
Displaying process arguments and environment for debugging purposes:
Arguments: (
"/Applications/Xcode-beta.app/Contents/Developer/usr/bin/xctest",
"/path/to/swift-testing/.build/debug/Package.xctest"
)
Environment: {
HOME = "<HOME>";
PATH = "<PATH>";
"SPM_INSTALL_PATH" = "/path/to/swift-testing/.build";
"__CF_USER_TEXT_ENCODING" = "0x1F5:0:0";
}
Notes
Inspection of .build/debug.yaml showed that the list of test targets was empty. The workaround was to nest tests inside of a folder Tests/ModuleName/, at which point running swift build discovers the test targets and swift test will succeed in building and running the tests.
I think it would be useful for swift test to support a top-level testing module. At the very least I think an error message should be shown here, instead of continuing until the xctest failure.
I did some investigation, and swift-build-tool exits with a successful status code even if no modules are defined for the specified target.