Objective
Running simple unit-test for an iOS app.
Setup
- Xcode (Version 14.1)
Sample Test:
import XCTest
@testable import SDKTestAppSwift
class SDKTestAppSwiftTests: XCTestCase {
func testExample() throws {
print("Test: testExample")
// This is an example of a functional test case.
let base = "asdfghjkl123"
XCTAssert(base == "asdfghjkl123")
}
}
Next to the ..
func testExample() throws {
.. Xcode provides a nice little ‘start single test‘-button.
I used to klick it to start the test, locally (Xcode IDE on mac).
This used to work properly.
Problem
Klicking the ‘start single test‘-button, an overlay appears:
For the sake of this question to be machine-readable:
There is no scheme and/or test plan that contains every test you are trying to run.
Create a new scheme and/or test plan containing the tests you want to run.
To close the overlay an ‘OK’-Button is delivered only.
Misleading solution (?!)
Just before there was no such scheme needed.
I wonder why would that changes ‘suddenly’.
From my point ov view Scheme/Testplans are executed ‘on startup’ of the device-emulator (or likewise), which is not my objective in the first place.
However – creating a TestPlan via:
File > New > File… > TestPlan
Adding the SDKTestAppSwiftTests-class using the +-Button.
… no success … :-/
Several other attempts
It seems my system is not the only one facing likewise issues.
- Problems with naming of test plans
No matter if there is a ‘test-plan’ and whatever name I assigned it – this is no solution.
- Default test plan
I seriously do not know how to create a ‘default test plan’ if it was not the way decribed before.
- Quit Xcode and delete ‘old configurations’
Something about files with old configurations which have to be deleted
In this case I am not sure which file and where to find it exactly.
Conclusion
Even though one of the obove may help you, for me the issue is not solved, yet.
Anyways
Thanks for reading & sharing – any help is appreciated π
2
Answers
There is another solution ...
First - Manage Schemes
Second - Create new Scheme
Third -> Celebrate, it's done .. :)
For me I fixed this through my scheme β Edit Scheme β Test β Plus Sign (Add Test Target) and then adding my unit test target.