2017-04-21 1 views
0

Impossible de savoir pourquoi le rapport FBSnapshotTestCase image not found while running Xcode test.Image FBSnapshotTestCase introuvable lors de l'exécution du test Xcode

J'ai essayé de lier FBSnapshotTestCase dans la cible ChartTests, mais toujours en voyant la même erreur. Je ne suis pas familier avec ceci, quelqu'un peut-il aider? Merci d'avance.

Reproduire:

Télécharger le projet de https://github.com/danielgindi/Charts

accédez à la racine du projet,

  1. (en option) exécuter carthage bootstrap installer la dépendance. Le projet a une vérification de dépendance, donc si vous ne l'exécutez pas, il l'exécutera au lancement du test.

  2. entrer

    xcodebuild -projet 'Charts.xcodeproj' -schéma 'ChartsTests' -configuration 'Debug' -sdk iphonesimulator -destination id = build propre 'E40B5365-EF82-430D-A767-2A37995CCEE1' Test

l'ID de destination pourrait être une UUID du simulateur sur la machine.

Ensuite, il rapporte:

2017-04-20 13:47:57.611 xctest[90924:13099756] The bundle “ChartsTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 
2017-04-20 13:47:57.611 xctest[90924:13099756] (dlopen_preflight(/Users/user/Library/Developer/Xcode/DerivedData/Charts-ambsdrskvocwekcmoobyhanaiixm/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/ChartsTests.xctest/ChartsTests): Library not loaded: @rpath/FBSnapshotTestCase.framework/FBSnapshotTestCase 
    Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Charts-ambsdrskvocwekcmoobyhanaiixm/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/ChartsTests.xctest/ChartsTests 
    Reason: image not found) 
2017-04-20 13:47:57.625 xcodebuild[90311:13086990] Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted} 

Testing failed: 
    Test target ChartsTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted) 
** TEST FAILED ** 

Répondre

0

Il est avéré que je dois ajouter un script d'exécution dans les phases de construire, et laisser carthage copier les cadres:

copie de https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos:

Sur votre demande Dans l'onglet "Build Phases" des cibles, cliquez sur l'icône "+" et choisissez "New Run Script Phase". Création d'un script d'exécution dans lequel vous spécifiez votre shell (ex:/bin/sh), ajoutez le contenu suivant dans la zone de script ci-dessous la coquille:

/usr/local/bin/carthage copy-frameworks 

et ajoutez les chemins aux cadres que vous souhaitez utiliser sous "Fichiers d'entrée", par exemple:

$(SRCROOT)/Carthage/Build/iOS/FBSnapshotTestCase.framework