2

API リクエスト メソッドのパフォーマンス テストを作成しようとしています。measureBlock なしで実行すると問題なく動作しますが、パフォーマンス テストとして使用すると次のエラー メッセージが表示されます。

*** -[Performance waitForExpectationsWithTimeout:handler:]、/SourceCache/XCTest_Sim/XCTest-7701/XCTestFramework/Classes/XCTestCase+AsynchronousTesting.m:236 /Users/iphonetest03/Desktop/shootr-ios/Tests/Performance でのアサーションの失敗。 m:42: エラー: -[Performance testPerformanceExample]: 失敗しました: 「NSInternalInconsistencyException」をキャッチしました。

どんな提案でも大歓迎です。ありがとう。これが私のコードです:

    @interface Performance : XCTestCase
       @property (nonatomic,strong)    XCTestExpectation *expectation;
       @property (nonatomic)           BOOL              serverResponse;
    @end

    @implementation Performance

       - (void)setUp {
          [super setUp];
          self.expectation = [self expectationWithDescription:@"Server response"];
       }

       - (void)tearDown {
          [super tearDown];
       }

       - (void)testPerformanceExample {
          [self measureBlock:^{
             [ShotQueueManager singleton].sendingrequestor = self;
             [[ShotQueueManager singleton] createShotQueueWithComment:@"iOS Shot creation performance test." andPhotoBinary:nil shotParent:nil userNameParent:nil andDelegate:self];
             [self waitForExpectationsWithTimeout:25.0 handler:^(NSError *error) {
                if (error) {
                   NSLog(@"Timeout Error: %@", error);
                }else{
                   XCTAssert(self.serverResponse);
                }
             }];
          }];
       }


       - (void)createShotResponseWithStatus:(BOOL)status andError:(NSError *)error {
          if (status && !error){
            self.serverResponse = YES;
            [self.expectation fulfill];
          }
       }
4

0 に答える 0