2016-06-08 4 views
0

테이블 뷰 셀의 값이 올바른지 테스트하려고합니다. 셀은 사용자 정의되고 자체 xib 파일이 있습니다. 내가 myApplicationTests에 XIB 파일에 모듈을 변경하면이 테스트 케이스에 대한 제대로 작동하기 시작하지만 일반적인 응용 프로그램 실행 작동하지 않습니다 Could not cast value of type 'myApplication.OrganizationTableViewCell' to 'myApplicationTests.OrganizationTableViewCell'UITableView 셀의 단위 테스트. 셀의 펜촉에 대한 액세스

:이 코드

self.organizationController?.organizationsTableView.registerNib(UINib.init(nibName:String(OrganizationTableViewCell), bundle: nil), forCellReuseIdentifier: String(OrganizationTableViewCell)) 
let organizationName = "Name" 
let organization = Organization.organizationWithName(organizationName, index: 0) 
self.organizationController?.organizations = [organization] 
let cell = self.organizationController?.organizationsTableView.cellForRowAtIndexPath(NSIndexPath(forRow: 0, inSection: 0)) as! OrganizationTableViewCell 
XCTAssertEqual(cell.organizationNameLabel.text, organizationName, "Cell created properly") 

나는 오류를 얻었다. 이 문제를 어떻게 해결할 수 있습니까?

답변

0

아마도이 달 전에 해결했을 것입니다 만, 네브의 대상 멤버십을 변경하여 myApplicationTests를 포함하거나 myApplication을 테스트 파일의 맨 위에 가져 오면됩니다.

관련 문제