Skip to content

Commit 0c06384

Browse files
authored
Add missing proxydispatcher cases + fix productModuleName for iOS <17 (danielpaulus#547)
The method switch in proxydispatcher::Dispatch was missing a few cases, which led to missing XCUITest results when using go-ios on iOS <17 devices. Additionally, the productModuleName field in the XCTestConfiguration appeared to be wrong (also for iOS <17 devices), leading to the same issue of missing test results. It has been changed to match the iOS 17 config, which seems to work better for the test cases I've tried.
1 parent 99b19bc commit 0c06384

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

ios/testmanagerd/proxydispatcher.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,32 @@ func (p proxyDispatcher) Dispatch(m dtx.Message) {
288288
}
289289

290290
p.testListener.testCaseDidStartForClass(testClass, testMethod)
291+
case "_XCT_testCaseDidStartWithIdentifier:iteration:":
292+
argumentLengthErr := assertArgumentsLengthEqual(m, 2)
293+
if argumentLengthErr != nil {
294+
decoderErr = argumentLengthErr
295+
break
296+
}
297+
298+
testIdentifier, decoderErr := extractTestIdentifierArg(m, 0)
299+
if decoderErr != nil {
300+
break
301+
}
302+
303+
p.testListener.testCaseDidStartForClass(testIdentifier.C[0], testIdentifier.C[1])
304+
case "_XCT_testCaseDidStartWithIdentifier:":
305+
argumentLengthErr := assertArgumentsLengthEqual(m, 1)
306+
if argumentLengthErr != nil {
307+
decoderErr = argumentLengthErr
308+
break
309+
}
310+
311+
testIdentifier, decoderErr := extractTestIdentifierArg(m, 0)
312+
if decoderErr != nil {
313+
break
314+
}
315+
316+
p.testListener.testCaseDidStartForClass(testIdentifier.C[0], testIdentifier.C[1])
291317
case "_XCT_testCaseDidStartWithIdentifier:testCaseRunConfiguration:":
292318
argumentLengthErr := assertArgumentsLengthEqual(m, 2)
293319
if argumentLengthErr != nil {

ios/testmanagerd/xcuitestrunner.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ func createTestConfigOnDevice(testSessionID uuid.UUID, info testInfo, houseArres
554554

555555
testBundleURL := path.Join(info.testApp.path, "PlugIns", xctestConfigFileName)
556556

557-
config := nskeyedarchiver.NewXCTestConfiguration(info.targetApp.bundleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version)
557+
productModuleName := strings.ReplaceAll(xctestConfigFileName, ".xctest", "")
558+
config := nskeyedarchiver.NewXCTestConfiguration(productModuleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version)
558559
result, err := nskeyedarchiver.ArchiveXML(config)
559560
if err != nil {
560561
return "", nskeyedarchiver.XCTestConfiguration{}, err
@@ -564,7 +565,7 @@ func createTestConfigOnDevice(testSessionID uuid.UUID, info testInfo, houseArres
564565
if err != nil {
565566
return "", nskeyedarchiver.XCTestConfiguration{}, err
566567
}
567-
return xctestConfigPath, nskeyedarchiver.NewXCTestConfiguration(info.targetApp.bundleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version), nil
568+
return xctestConfigPath, nskeyedarchiver.NewXCTestConfiguration(productModuleName, testSessionID, info.targetApp.bundleID, info.targetApp.path, testBundleURL, testsToRun, testsToSkip, isXCTest, version), nil
568569
}
569570

570571
func createTestConfig(info testInfo, testSessionID uuid.UUID, xctestConfigFileName string, testsToRun []string, testsToSkip []string, isXCTest bool, version *semver.Version) nskeyedarchiver.XCTestConfiguration {

0 commit comments

Comments
 (0)