2017-03-13 9 views
0

/민첩 결국 빠른의 대체 자 NSPredicate를 사용하여 :xctest을 내가 xctest하기/빠른 민첩한에서 테스트 케이스 아래에 변환하려고

: 아래
expect(foundation.appGuid).toEventually(equal(guidValue)) 

내가 사용하고있는 코드 만 테스트 충돌입니다
let successPredicate = NSPredicate(format: "SELF MATCHES %@", guidValue) 
    expectation(for: successPredicate, evaluatedWith: foundation.appGuid) { 
     return foundation.appGuid == guidValue 
    } 

    waitForExpectations(timeout: 5) { (error) -> Void in 
     if error != nil { 
     XCTFail("foundation.appGuid NOT Equal to guidValue") 
     } 
    } 

나는 위의 코드에서 잘못된 것을하고 있습니까?

+0

가 APPGUID로 guidValue 같은 종류인가? – Oletha

+0

예 그들은 동일한 유형입니다 – user1452936

답변

0

이 일 :

let successPredicate = NSPredicate(format: "SELF == %@", self.guidValue) 
    expectation(for: successPredicate, evaluatedWith: foundation.serviceConfig.appGuid) { 
     return foundation.serviceConfig.appGuid == self.guidValue 
    } 

    waitForExpectations(timeout: 5) { (error) -> Void in 
     if error != nil { 
     XCTFail("foundation.serviceConfig.appGuid NOT Equal to guidValue") 
     } 
    } 
+0

MATCHES 이후 정규식 대신에 == 사용 MATCHES 정규식의 경우 – user1452936