Skip to content

Commit 304ddfb

Browse files
nanwngShawn Chen
authored and
Shawn Chen
committed
Trigger the test when the bundle is actually connected (#547)
Signed-off-by: Nan Wang <nanwang1101@yahoo.com> Signed-off-by: Nan Wang <nanwang1101@yahoo.com>
1 parent dd6d563 commit 304ddfb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bp/src/BPTMDRunnerConnection.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ @interface BPTMDRunnerConnection()<XCTMessagingChannel_DaemonToIDE, XCTMessaging
4848

4949
@property (nonatomic, weak) id<BPTestBundleConnectionDelegate> interface;
5050
@property (nonatomic, assign) BOOL connected;
51+
@property (nonatomic, assign) BOOL testBundleReady;
5152
@property (nonatomic, strong) dispatch_queue_t queue;
5253
@property (nonatomic, strong) NSString *bundleID;
5354
@property (nonatomic, assign) pid_t appProcessPID;
@@ -76,11 +77,14 @@ - (void)connectWithTimeout:(NSTimeInterval)timeout {
7677

7778
// Pool connection status till it passes.
7879
[BPUtils runWithTimeOut:timeout until:^BOOL{
79-
return self.connected;
80+
return self.connected && self.testBundleReady;
8081
}];
8182
if (!self.connected) {
8283
[BPUtils printInfo:ERROR withString:@"Timeout establishing a runner session!"];
8384
}
85+
if (!self.testBundleReady) {
86+
[BPUtils printInfo:ERROR withString:@"Timeout connecting to the test bundle!"];
87+
}
8488
}
8589

8690
- (void)connect {
@@ -279,12 +283,14 @@ - (id)_XCT_didBeginExecutingTestPlan {
279283

280284
- (id)_XCT_testBundleReadyWithProtocolVersion:(NSNumber *)protocolVersion minimumVersion:(NSNumber *)minimumVersion {
281285
self.connected = YES;
286+
self.testBundleReady = YES;
282287
[BPUtils printInfo:INFO withString:@"Test bundle is connected. ProtocolVersion= %@, minimumVersion = %@", protocolVersion, minimumVersion];
283288
return nil;
284289
}
285290

286291
- (id)_XCT_testRunnerReadyWithCapabilities:(XCTCapabilities *)capabilities {
287292
self.connected = YES;
293+
self.testBundleReady = YES;
288294
[BPUtils printInfo:INFO withString:@"Test bundle is connected. Capabilities = %@", capabilities];
289295
return nil;
290296
}

0 commit comments

Comments
 (0)