Hi I have 2 different test case in my iOS project
import XCTest
@testable import MyApp
final class MyAppXCTests: XCTestCase {
func testXCToggleOne() throws {
XCTAssertTrue(true)
}
}
and
import Testing
@testable import MyApp
struct MyAppTests {
@Test func one() async throws {
#expect(true)
}
}
so, these are the "test link" of them
test://com.apple.xcode/MyApp/MyAppTests/MyAppTests/one() test://com.apple.xcode/MyApp/MyAppTests/MyAppXCTests/testOne
and trying to run the test with command line tool xcTest work just fine with one test
xcodebuild \
-project ./MyApp.xcodeproj \
-scheme MyApp \
-destination "platform=iOS Simulator,name=iPhone 16,OS=26.0" \
-enableCodeCoverage YES \
-only-testing:MyAppTests/MyAppXCTests/testOne \
test
Testing started
Test suite 'MyAppXCTests' started on 'Clone 1 of iPhone 16 - MyApp (23162)'
Test case 'MyAppXCTests.testOne()' passed on 'Clone 1 of iPhone 16 - MyApp (23162)' (0.008 seconds)
2025-09-06 17:57:04.662 xcodebuild[22710:446741] [MT] IDETestOperationsObserverDebug: 213.516 elapsed -- Testing started completed.
2025-09-06 17:57:04.662 xcodebuild[22710:446741] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2025-09-06 17:57:04.662 xcodebuild[22710:446741] [MT] IDETestOperationsObserverDebug: 213.516 sec, +213.516 sec -- end
...
** TEST SUCCEEDED **
but testing framework is not finding the test, it tests with empty test case
xcodebuild \
-project ./MyApp.xcodeproj \
-scheme MyApp \
-destination "platform=iOS Simulator,name=iPhone 16,OS=26.0" \
-enableCodeCoverage YES \
-only-testing:MyAppTests/MyAppTests/one \
test
Testing started
2025-09-06 18:00:31.711 xcodebuild[23201:458635] [MT] IDETestOperationsObserverDebug: 136.597 elapsed -- Testing started completed.
2025-09-06 18:00:31.712 xcodebuild[23201:458635] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2025-09-06 18:00:31.712 xcodebuild[23201:458635] [MT] IDETestOperationsObserverDebug: 136.597 sec, +136.597 sec -- end
...
** TEST SUCCEEDED **
(no test case nor function is there)
while "test link" have brackets for testing framework one but getting error
xcodebuild \
-project ./MyApp.xcodeproj \
-scheme MyApp \
-destination "platform=iOS Simulator,name=iPhone 16,OS=26.0" \
-enableCodeCoverage YES \
-only-testing:MyAppTests/MyAppTests/one() \
test
bash: syntax error near unexpected token `('
or maybe adding test prefix like obj-c style? but was also not finding the test
xcodebuild \
-project ./MyApp.xcodeproj \
-scheme MyApp \
-destination "platform=iOS Simulator,name=iPhone 16,OS=26.0" \
-enableCodeCoverage YES \
-only-testing:MyAppTests/MyAppTests/testOne \
test
Testing started
2025-09-06 18:05:47.907 xcodebuild[23592:469875] [MT] IDETestOperationsObserverDebug: 110.440 elapsed -- Testing started completed.
2025-09-06 18:05:47.908 xcodebuild[23592:469875] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2025-09-06 18:05:47.908 xcodebuild[23592:469875] [MT] IDETestOperationsObserverDebug: 110.440 sec, +110.440 sec -- end
Test session results, code coverage, and logs:
/Users/albertqpark/Library/Developer/Xcode/DerivedData/MyApp-ciatdpfijuuoogheatkwrvifcwtc/Logs/Test/Test-MyApp-2025.09.06_18-03-51--0700.xcresult
** TEST SUCCEEDED **