skip to Main Content

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:

Xcode warning overlay - information below

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.

  1. Problems with naming of test plans

No matter if there is a ‘test-plan’ and whatever name I assigned it – this is no solution.

  1. Default test plan

I seriously do not know how to create a ‘default test plan’ if it was not the way decribed before.

  1. 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


  1. Chosen as BEST ANSWER

    There is another solution ...

    First - Manage Schemes

    Navigate to 'manage schemes'

    Edit schemes

    Second - Create new Scheme

    Navigate to 'create new scheme'

    Create new scheme

    Third -> Celebrate, it's done .. :)


  2. For me I fixed this through my scheme β†’ Edit Scheme β†’ Test β†’ Plus Sign (Add Test Target) and then adding my unit test target.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search