I am trying to paerform a unit test on my application and majority of the test failed and the reason it says is Asynchronous wait failed: Exceeded timeout of 30 seconds, with unfulfilled expectations: "Home Code".
I do not know why it fails like this but this is my code below
class HomeTest: XCTestCase {
override func setUp() {
}
override func tearDown() {
}
func testHome() {
let expec = expectation(description: "Home Code")
let presenter = HomePresenter(view: HomeTestVC(expectation: expec), source: Repository.instance)
presenter.start()
wait(for: [expec], timeout: 30)
}
func testPerformanceExample() {
self.measure {
}
}
}
class HomeTestVC: HomeContract.View {
func showRatingForLastTrip(_ trip: Trip) {}
func setProgress(enabled: Bool) {}
func didFail(message: String) {}
func didShowError(error: Error) {}
func didShowStatusCode(code: Int?) {
XCTAssertGreaterThan(200, code ?? 0)
self.expec.fulfill()
}
var expec: XCTestExpectation
init(expectation: XCTestExpectation) {
self.expec = expectation
}
}
It pops up the simulator but stays on just the first screen. I do not know why. Any help would be appreciated