문제

XCTEST 및 XCODE 5 단위 테스트를보고 Xcode 5의 계측기에서 내 장치 테스트를 실행하는 방법을 보지 못했습니다 ...

특히 테스트 중 누출을 찾고 싶습니다 (이 경우이 예에서는 자동화 할 필요는 없지만 유용 할 수 있지만 유용 할 수 있습니다).

가능?

도움이 되었습니까?

해결책

이것은 이것이 가장 쉬운 방법이라고 생각합니다 :

  1. 테스트의 어딘가에 중단 점을 설정합니다 (설치 방법에서 해본 적이 있음)
  2. 악기에 새 문서를 엽니 다
  3. 응용 프로그램을 실행하고 중단 점에서 중지되었는지 확인하십시오
  4. 도구의 대상 드롭에서 첨부를 선택하고 프로세스로 스크롤
  5. 레코드를 클릭 한 다음 Xcode
  6. 재개를 클릭하십시오.

다른 팁

Xcode에서 테스트 네비게이터에서 테스트를 마우스 오른쪽 단추로 클릭하고 "프로파일"testName "":

를 선택하십시오.

악기 프로파일 단위 테스트 메모리

Xcode 6에서 수행 할 수있는 올바른 방법은 다음과 같습니다.

1) Xcode 프로젝트에서 "제품"폴더를 표시하고 ".xctest"제품을 선택하고 마우스 오른쪽 버튼을 클릭하고 마지막으로 컨텍스트 메뉴에서 "Finder에서 공개"를 선택하십시오.

2) 악기를 시작하고 원하는 템플리트로 새 문서를 만듭니다.

3) 문서의 경우 "대상 선택 ..."을 수행하십시오.

4) 공구 xcode 탐색 및 선택 /Applications/Xcode.app/Contents/Developer/usr/bin/xctest에있는 테스트를 실행하는 데 사용합니다 (터미널에서 xcrun -f xctest를 사용 하여이 위치를 찾을 수 있습니다). "트래버스 패키지"를 활성화하여 Xcode 응용 프로그램을 탐색해야합니다.

5) 파인더에서 "인수"필드로 끌어서 놓기 단계 1에서 밝혀진 ".xctest"제품이 절대 경로로 들어갑니다.

6) "선택"을 클릭하십시오.

이제 악기에서 장치 테스트를 실행할 준비가되었습니다!

여기에 이미지 설명

I created a new target based on the mac app target I am testing, then added the xctest classes to the files to compile.

I then added the /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework to the frameworks to link against.

Then added its path $(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/Library/Frameworks to the Runpath Search Paths.

Then in the main.m I added the following:

    XCTestSuite *suite = [XCTestSuite testSuiteWithName:@"My tests"];
    [suite addTest:[VideohogCachingTest testCaseWithSelector:@selector(testCompleteSequentialText)]];
    [suite run];

This ran the test testCompleteSequentialText on the class VideohogCachingTest I needed to run as a normal application, therefore allowing me to run the test by either command+R or in this case, profiling with command+I. I could then catch a zombie and trace the problem, which was not a possibility for me previously. If you'd like to run all your tests you can do:

XCTestSuite *suite = [XCTestSuite defaultTestSuite];
[suite run];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top