development

테스트 대상 X에 오류가 발생했습니다 (예기치 않은 조기 종료, 작업이 부트 스트랩을 완료하지 않음-다시 시작하지 않음)

big-blog 2020. 10. 23. 08:04
반응형

테스트 대상 X에 오류가 발생했습니다 (예기치 않은 조기 종료, 작업이 부트 스트랩을 완료하지 않음-다시 시작하지 않음)


내 프로젝트 작업 공간에 통합 한 기존 프로젝트에 대한 테스트 케이스를 작성하기 위해 OCMock과 함께 작업하기 시작했습니다. 링크에 언급 된 모든 단계를 수행 한 후

처음 테스트 케이스를 실행했을 때이 오류가 발생했습니다. 나는 그것을 검색하고 "새 대상 만들기", "Xcode 다시 시작"과 같은 몇 가지 솔루션을 시도했지만 도움이되지 않았습니다. 어떤 아이디어?


Cocoapods와 Carthage 모두에 대한 노트와 데모 애플리케이션이 있습니다. https://github.com/onmyway133/TestTarget

  • 모든 프레임 워크가 테스트 대상에 연결되었는지 확인
  • Runpath Search Paths가리 키도록 구성$(FRAMEWORK_SEARCH_PATHS)

더 많은 정보


나는 카르타고를 사용하고 있으며 문제는 테스트 대상에서 종속성을 검색하는 것이 었습니다. 고치다:

추가 $(PROJECT_DIR)/Carthage/Build/iOSRunpath Search Paths

여기에서 참조를 찾을 수 있습니다 : 카르타고 문제


CocoaPods를 사용하고 UI 테스트 대상이 앱 대상 내부에 포함되어있는 경우 다른 솔루션이있을 수 있습니다. 불행히도 기본 템플릿 ( pod init) 의 경우입니다 .

다음과 같이 UI 테스트 대상을 앱 대상 밖으로 이동해보십시오 .

에서:

platform :ios, '11.0'
use_frameworks!

target 'MyApp' do
  # Pods for MyApp

  target 'MyAppUITests' do
    inherit! :search_paths
    # Pods for testing

  end
end

에:

platform :ios, '11.0'
use_frameworks!

# Pods shared between MyApp and MyAppUITests    

target 'MyApp' do
    # Pods for MyApp only

end

target 'MyAppUITests' do
    # Pods for testing

end

크레딧은이 문제 스레드의 SpacyRicochet으로 이동합니다 : https://github.com/CocoaPods/CocoaPods/issues/4752#issuecomment-305101269


제 경우에는 링크 된 파일에 문제가 없었습니다. 시뮬레이터는 "앱 이름이 알림을 보내려고합니다."와 같이 앱이 트리거 한 메시지에 멈춰있었습니다. OK를 누르고 다음에 XCTests가 제대로 작동했습니다.


내 솔루션은 내 테스트 대상에 "파일 복사 단계"를 추가하는 것이 었습니다. 거기에서 대상을 Frameworks로 설정하고 + 기호로 프레임 워크를 추가했습니다.


이 오류에 대한 내 경험을 공유하기 위해 :

저는 fastlane + cocoapods를 사용하고 있습니다.

2 개의 동적 프레임 워크가있는 작업 공간이 있습니다.

  • A. 프레임 워크
  • B. 프레임 워크

종속성 :

  • A는 cocoapods를 사용하는 AFNetworking에 따라 다릅니다.
  • B는 A에 의존

종속성은 Podfile에 정의됩니다.

프레임 워크 B 테스트를 실행하면 오류가 발생했습니다.

제 경우 문제는 B.framework 대상의 AFNetworking에 대한 종속성 누락과 관련이 있습니다.

Podfile의 B.framework에서 AFNetworking에 포드 종속성을 추가하면 모든 문제가 해결되었습니다.

따라서 대상 B가 성공적으로 컴파일 되더라도 AFNetworking이 B 테스트 앱에 포함되지 않았고 시뮬레이터가 B 테스트 앱을 실행할 수 없어이 "매우 의미있는"(*) 오류가 발생했습니다.

(*) Apple에 감사드립니다!


제 경우에는 Build Active Architecture Only가 YES로 설정되었습니다.

프로젝트 및 대상에서 : 빌드 설정-> 아키텍처-> 활성 아키텍처 만 빌드는 예 대신 아니오 여야합니다.


와우,이 작업에 많은 시간을 낭비했습니다. 내 테스트 번들에는 내 애플리케이션에 대한 "호스트 애플리케이션"이 선택되었습니다. 다른 테스트 번들은 그렇지 않았습니다.

이 솔루션이 모든 상황에 적합한 솔루션은 아닐 수 있지만 내 테스트는 주로 동적 라이브러리를 테스트하는 것이었고 실제로 실행하는 데 호스트 응용 프로그램이 필요하지 않았습니다. 위의 오류가 발생하여이 기능을 끄면 해당 오류없이 테스트를 실행할 수 있었고 중단 점이 작동했습니다. 나는 MacOS를 실행하고 있었지만 아마도 다른 환경에서도 비슷할 것입니다. 이 솔루션이 모든 상황에 적합한 솔루션은 아닐 수 있지만 내 테스트는 주로 동적 라이브러리를 테스트하는 것이었고 실제로 실행하는 데 호스트 응용 프로그램이 필요하지 않았습니다.

테스트 번들에서 일반-> 테스트-> "호스트 응용 프로그램"을 없음으로 설정합니다.


제 경우에는 Carthage를 사용하여 통합 한 Quick 및 Nimble 라이브러리에 대한 Run Script 단계를 추가하지 않았습니다.


나는 같은 문제가 있었고 이미 여기에서 제안 된 모든 것을 성공하지 못했습니다.

다른 시뮬레이터에서 테스트를 실행하면 문제가 해결되었습니다. 그 후, 원래 시뮬레이터는 더 이상 실패를 일으키지 않았습니다.


내 사건은 특별했다. 테스트 클래스로 2 개의 파일을 사용했습니다. 하나는 완벽하게 작동했고 다른 하나는 그 오류가있었습니다.
둘 다 동일한 프레임 워크에 대해 연결됩니다.

해결책

파생 데이터 지우기

=> 프로젝트 => 삭제 (프로젝트에서)

행운과 행복한 테스트!


I tried many different options but none helped me except below and wasted lot of time, posting this so that really help and save time on this: 

Follow all of the instructions for Full Manual Configuration

https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md#full-manual-configuration
Tips
When you come to the part where you are executing xcodebuild, if the build fails, and the log mentions "RoutingHTTPServer" or "YYCache", add these two frameworks on the Build Phases tab of the WebDriverAgentRunner target
Open the WebDriverAgent.xcodeproj

Select 'Targets' -> 'WebDriverAgentRunner'

Open 'Build Phases' -> 'Copy frameworks'

Click '+' -> add RoutingHTTPServer

Click '+' -> add YYCache
https://github.com/facebook/WebDriverAgent/issues/902#issuecomment-382344697
https://github.com/facebook/WebDriverAgent/issues/902#issuecomment-383362376

The build/test may also fail due to the WebDriverAgentRunner app/developer being untrusted on the device. Please trust the app and try again.

While trying to access the WebDriverAgent server status, if it tries to connect on port 0, hardcode port 8100 in appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Routing/FBWebServer.m

Original line: server.port = (UInt16)port;
New line: server.port = 8100;
https://github.com/facebook/WebDriverAgent/issues/661#issuecomment-338900334

Cocoa Touch Framework를 만드는 동안 테스트를 실행하려는 모든 시도는 OP가 쓴 것과 같은 오류 메시지로 끝났습니다.

TEST의 빌드 구성을 Debug에서 Release로 변경하여 수정했습니다.

1 단계

여기에 이미지 설명 입력

2 단계

여기에 이미지 설명 입력

3 단계

여기에 이미지 설명 입력

참고 :에 대한 추가 구성이 필요하지 않았습니다 Runpath Search Paths.

Ver 1.6.1 및 Xcode 10.1에서 Cocoapods를 사용하고 있습니다.


Would like to share my answer hope it could save someones time.

For me .m file was not properly linked under Build Phases - > Compile Sources


In my case, I had declared a property as readonly in a header file:

// In .h file
@property (nonatomic, readonly) NSUInteger count;

but I forgot to add this declaration to the .m so a setter would be generated:

// In .m file
@property (nonatomic, assign) NSUInteger count;

Silly mistake, not totally sure why it manifested in this error, but adding that line to the .m fixed the problem.


In my case, my Build Settings -> Architectures was setting only for armv7 and I changed for ARCHS_STANDARD that was the same of my Host Application


For me, I had to 'Trust' developer in 'Device Management' under 'Settings -> General' on my device. (Settings -> General -> Device Management -> DeveloperID -> 'Trust the app') As I was running app through side loading using my apple ID.


In my case I had to remove $(inherited) from Other Linker Flags in my ui test target. I have installed static libraries via cocoapods.


for me the problem was the Pod file
I made a new target but forgot add target in the pod file

target 'mobilesdkIntegrationTests' do
  // write here any predefined pods if any, like
  testing_pods
end

just add target in the pod file fixed the issue


There are some automatically added project settings that come with Xcode 10, and they come some of the time, not all of the time. After downloading Xcode 10, restart your computer. That is what fixed this for me. None of these answers fixed it for me. I hope this helps. I wish I could give a better answer.


Switching from Xcode 9.4.1 to Xcode 10.1 solved the problem in my case.


In my case I had completely clean project with default empty tests. If I have added any pod I received this error. Solution was that at least one file in Test target should import Foundation

import XCTest
import Foundation

@testable import CVZebra

class CVZebraTests: XCTestCase {

    override func setUp() {
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
    }

    func testExample() {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }

    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.
        }
    }

}

If anybody still experience this issue this answer helped me. Set Always Embed Swift Standard Libraries to No in the projects settings. I did it for the UI test target.


제 경우에는 시뮬레이터의 앱에 문제가있었습니다. 문제가 발생하기 전에 db-migration (realm)을 처리하여 내 db를 실패하고 파괴했습니다. 그래서 시뮬레이터에서 앱을 삭제 한 후 모든 것이 잘 작동했습니다.

참고 URL : https://stackoverflow.com/questions/34990175/test-target-x-encountered-an-error-early-unexpected-exit-operation-never-finis

반응형