XCTest Does Not Call `setUp`

Asked 1 years ago, Updated 1 years ago, 116 views

I am trying to do an XCTest, but neither setUp nor testExample are called in the code below.

import XCTest

class HogeTests:XCTestCase{

    override funcsetUp(){
        // Put setup code here. This method is called before the invocation of each test method in the class.
        super.setUp()
    }

    override functearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testExample(){
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
        XCTAssert(true)
    }

    functestPerformanceExample(){
        // This is an example of a performance test case.
        measure{
            // Put the code you want to measure the time of here.
        }
    }

}

If you press the diamond play button, it will be built and the application will start on the actual machine.
Xcode will continue to be in the following state for a while, then Test Failed, and the app will drop.

Enter a description of the image here

Please let me know if you have any questions.

swift ios xcode objective-c test

2022-09-30 21:46

1 Answers

I solved myself!Thank you very much for your reply!
The reason was that ProvisioningProfile was not configured on the test target.
The following was helpful!!

https://stackoverflow.com/questions/31381291/unable-to-run-xctests-on-ios-device


2022-09-30 21:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.