异步等待失败:对于Unit Test case swift

时间:2017-03-24 06:58:07

标签: ios swift xcode asynchronous

我的单元测试用例失败

waitForExpectations(timeout: 50, handler: nil)

有错误

  

异步等待失败:超出50秒超时,未满足期望:

  func testThatItSummery() {

       let expectation = self.expectation(description: "GET  SUMMERY")

        Request.jobSummary(startDate: startDateStr, endDate: endDateStr).execute().fetchResponseJSON({(_, _, json, error) in
            if error != nil {
                NSLog("Response error:\(error)")
                XCTAssertNotNil(error, "JobSummary Response error")
                expectation.fulfill()
            } else {
                let jobSummaryJson = json["job"]
                XCTAssertNotNil(json, "JobSummary Response")

                expectation.fulfill()
            }
        })
        waitForExpectations(timeout: 50, handler: nil)
    }
}

0 个答案:

没有答案