Swift Testing not recognising tests

For my app I was trying to write some tests to ensure the functionality of all features. As I am using Xcode 16.0 I thought I might use Swift testing which was newly introduced and replaces XCTest.

I created a new test target with Swift Testing and tried to run the first test, which was created automatically by the system.

struct FinancialTests {
    @Test func testExample() async throws {
        #expect(true)
    }
}

Xcode is also showing the test diamond next to the function so I clicked on it to execute it. The app started to build and the build ended successfully. The the next step was testing. And after waiting for 10 minutes or so, no test was executed. First I thought maybe the test was not found, but in the test case overview all tests were shown:

The run only shows this:

Can someone help me to get this running.

Many thanks!

I also created a new project with the exact same test and there it worked. I am confused.

@Timo21 Are you able to share a public link to the Xcode project that reproduces your issue?

I had the same issue in my project, which is still on Swift 5. The tests wouldn’t run even though the project built successfully. I tried converting the folder to a group and setting the Swift 6 compiler for the test target, but it didn’t help. I found a thread suggesting the problem could be with the simulator. The solution was to delete all simulators using xcrun simctl delete all. After that, the tests started running. I did run into some dependency issues, but that’s a separate problem. Try this solution, it might help you!

Swift Testing not recognising tests
 
 
Q