Bonjour not working with UI Test Target

I am trying to browse an SSH Service from UI Test Target using NWBrowser

let descriptor = NWBrowser.Descriptor.bonjour(type: "_superapp._tcp", domain: "local.")
let browser = NWBrowser(for: descriptor, using: .tcp)
browser.stateUpdateHandler = { newState in
            print("browser.stateUpdateHandler \(newState)")
        }

I get failed(-65555: NoAuth) error

nw_browser_fail_on_dns_error_locked [B1] DNSServiceBrowse failed: NoAuth(-65555)

I have added _superapp._tcp in Bonjour Services for UI Test Target Info.plist.

I have also added Local Network Permission in UI Test Target Info.plist.

Everything works fine, when I call this Bonjour service from App Target.

Doesn't work when I call this from UI Test Target.

I have added _superapp._tcp in Bonjour Services for UI Test Target Info.plist.

That won’t work because a UI test target isn’t a main executable, but rather a bundle that’s loaded by a test runner. You’d need to set this property on the test runner itself, which isn’t possible because that runner in managed by Xcode.

Why do you need to do this? Are you trying to locate some service necessary to run your test? Or confirm that your app is correctly registering its service with Bonjour?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

My UI tests on iOS require few commands to be executed on host Mac Terminal during execution. I am trying to achieve this via Bonjour Services where my UI Test on iOS will connect to the Bonjour service on host Mac and send commands to be executed. Is there any workaround to run Bonjour services within UI Test Bundle ?

Is there any workaround to run Bonjour services within UI Test Bundle ?

I’ve yet to find a way to achieve for this )-:

One option is to add a hidden UI option to your app, and then put this Bonjour code in the app itself.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Bonjour not working with UI Test Target
 
 
Q