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.
Testing
RSS for tagDetect issues like logic failures, UI problems, and performance regressions by running tests on your app.
Posts under Testing tag
111 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
In the latest version of Xcode, breakpoints are not displaying correctly, making it difficult to track code behavior. Previously, Xcode allowed you to step through each function, showing clear execution steps and allowing interaction to debug effectively. However, now it only shows memory addresses without providing meaningful insights, limiting the ability to interact with or test the code as it's being developed. Is anyone else experiencing this issue, or does anyone know of a workaround?
I test my app, by building it and hoping it will go on my iOS. This is the only workflow I have to test my testing app.
I use AVAudioEngine and AVAudioSession. It sounds painful but, yes. I literally comment out parts and build the app everytime and see if it would crash or not.
Sometimes I'd get Crash Logs in the Analytics part, but I haven't managed to get them there anymore. So I had no more Crash Logs.
I was wondering if there's a function or something. Maybe something that I can do in AppDelegate to make it create a Crash Log somewhere?
Uncaught Exception overwrite, didn't solve the issue for me. It really has to be an actual crash log, something that catches these.
If someone knows, let me know! Thanks
I am new. I have never used Swift nor XCode or the CLI. But I have found and managed to test my App that I created for testing on my iPhone.
I have absolutely no intentions to put it on the App Store. I even made it Open-Source on GitHub.
I learned a lot of things and ways to prevent crashes, but unfortunately I am slowly starting to lose the ability to put my App on my iOS.
I am new here as a developer. But I have troubles to create a Developer Account, so I am not sure what I should do.
Here's what I think I am having issues with:
I feel like you can only create a Developer Account if you have a business, is this true?
I really find it cool to test my own App on my own phone. But I want to do it in an official way. But I don't know how.
Others have told me that you'd need a License for the App Store. But I am not trying to put it on the App Store, will this make it impossible for me to test my own app?
Why make an app if not putting it on the App Store?
You can learn. If you make good Apps or Libraries, you can provide them to other Developers! Maybe even an opportunity to collab with someone and even indeed put it on the App Store with a valid Developer Account.
Seriously, if I wouldn't have been able to test my iOS app through other ways on my iPhone, I'd have never been able to make a short breakdown about AVAudioEngine and AVAudioSession. I've seen people that have run into these crashes. I tried to look up for a fix, but found none.
I saw apps that allowed you to use a Microphone on a Laptop/PC and I decided to make my own one to test, and succeded, while I yet need to figure out a few crashes, I managed to do it, and I really want to continue and actually use my own App...
So I was really happy that I could make a post to provide a guide in hopes that it would help someone. And I would do more, but I really need help with figuring out how I can test my own app on my own phone.
I hope that Developer Relations can help with this.
Hi,
I work on a iOS application which includes several local swift packages containing modularised code. Each of those local swift packages has a test target defined in their respective Package.swift, and when opening a local package folder standalone in Xcode, then the tests run without issues.
However I would like in the main app's test plan to add the local package test targets and have them all run together when the main app's default test plan is run. Xcode allows me to select local package test targets within the main app's test plan (also within Test portion of the main app's scheme), however attempting to build for testing throws a "Module '…' was not compiled for testing".
Any ideas on how to achieve this goal (run local package tests in conjunction with main app's tests) and avoid that error?
Thanks
Peter
Firefox and Chrome provide various options and services to set up browser characteristics while testing. These can be used with Selenium while setting up the driver.
An example with Firefox is setting a custom user agent and a download directory different than the default. Using Python:
from selenium.webdriver.firefox.options import \
Options as FirefoxOptions
from selenium.webdriver.firefox.service import \
Service as FirefoxService
firefox_options = FirefoxOptions()
# set up user agent
user_agent = UserAgent().get_user_agent()
firefox_options.set_preference("general.useragent.override", user_agent)
# set alternate download location
firefox_options.set_preference('browser.download.folderList', 2)
firefox_options.set_preference('browser.download.dir', download_dir_path)
Many of these browser-specific options and services are listed at Selenium's website under Supported Browsers.
However, Safari's information is very limited. On Selenium's site, for example, they list how to turn on Safari's limited logging: service = webdriver.SafariService(service_args=["--diagnose"]). Then, they point us to About WebDriver for Safari - which shows automaticInspection and automaticProfiling. The page primarily describes security features for testing with Safari.
In a regular user session, one can configure an alternate download directory, set a custom profile with specific settings for that profile, and so on. And, in the Developer Menu I can set some of these items manually for a given session (user agent, for example).
How can I access these features within Safari for use in automated web testing with Selenium?
Edit: Alternatively, does Apple have, or recommend, a different automated testing package for Safari?
I am using two iPhone11 devices, having iOS v17.6.1 for automation testing using Seleniumv4.X-Appium v2.x.
Today I updated the mac to Sequoia15 version which updated the XCode to v16.
Just after this update, I could not able to run the previously running automation script. The console message is "org.openqa.selenium.SessionNotCreatedException:
Could not start a new session. Response code 500. Message: Unable to launch WebDriverAgent. Original error: xcodebuild failed with code 70. This usually indicates an issue with the local Xcode setup or WebDriverAgent project configuration or the driver-to-platform version mismatch."
I tried to use XCTest to test my own project that uses EndpointSecurity, but when I created the esClient I got an error:ES_NEW_CLIENT_RESULT_ERR_NOT_PRIVILEGED, indicating that it was not root.
This makes it impossible for me to do coverage tests for the ESClient application. Is there any way I can implement this ESClient test? If so, how should I use it? The project is a macOS program, if I use gcov, but I find I can't get coverage. Using __gcov_flush will indicate that there is no symbol
#if !TARGET_IPHONE_SIMULATOR
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
setenv("GCOV_PREFIX", [documentsDirectory cStringUsingEncoding:NSUTF8StringEncoding], 1);
setenv("GCOV_PREFIX_STRIP", "13", 1);
#endif
extern void __gcov_flush(void);
__gcov_flush();
#endif
I am creating a iOS library project using Xcode 15 in objective C lang which has dependency XCTest framework and Objective C run time and having UI test cases which can be use used in various projects.
I am able to build and run unit test cases using Xcode fine but when try to run test using command line getting below issue
Command
env NSUnbufferedIO=YES xcodebuild clean test -workspace EnptyLibrary.xcworkspace -scheme EnptyLibrary -configuration Debug -destination 'platform=iOS Simulator,OS=latest,name=iPhone 15 Pro' -destination 'platform=iOS Simulator,OS=latest,name=iPad Pro (12.9-inch) (6th generation)' -testPlan EnptyLibrary -derivedDataPath build -disable-concurrent-destination-testing -retry-tests-on-failure=NO
Error log
** TEST SUCCEEDED **
2024-09-12 16:36:34.822 xcodebuild[8345:45388802] Writing error result bundle to /var/folders/12/rcxtcvjs08169cc_fzhyc8x40000gq/T/ResultBundle_2024-12-09_16-36-0034.xcresult
2024-09-12 16:36:34.832 xcodebuild[8345:45388802] [MT] DVTAssertions: ASSERTION FAILURE in IDEFrameworks/IDEFoundation/ProjectModel/ActionRecords/IDESchemeActionsInvocationRecord.m:458
Details: Assertion failed: !self.hasSaved
Object: <IDESchemeActionsInvocationRecord: 0x112c21ce0>
Method: -saveWithCompletionBlock:
Thread: <_NSMainThread: 0x600000e441c0>{number = 1, name = main}
Hints:
Backtrace:
0 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
1 _DVTAssertionHandler (in DVTFoundation)
2 _DVTAssertionFailureHandler (in DVTFoundation)
3 _DVTAssertionWarningHandler (in DVTFoundation)
4 -[IDESchemeActionsInvocationRecord saveWithCompletionBlock:] (in IDEFoundation)
5 -[IDESchemeActionsInvocationRecord saveSynchronouslyWithError:] (in IDEFoundation)
6 -[Xcode3CommandLineBuildTool saveResultBundleForError:triageWithSchemeTask:error:] (in Xcode3Core)
7 -[Xcode3CommandLineBuildTool _printError:schemeTask:andFailWithCode:] (in Xcode3Core)
8 -[Xcode3CommandLineBuildTool _printErrorWithSchemeTaskUserInfo:] (in Xcode3Core)
9 -[Xcode3CommandLineBuildTool _buildWithTimingSection:] (in Xcode3Core)
10 -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
11 XcodeBuildMain (in libxcodebuildLoader.dylib)
12 -[XcodebuildPreIDEHandler loadXcode3ProjectSupportAndRunXcode3CommandLineBuildToolWithArguments:] (in xcodebuild)
13 -[XcodebuildPreIDEHandler runWithArguments:] (in xcodebuild)
14 main (in xcodebuild)
15 start (in dyld)
zsh: abort env NSUnbufferedIO=YES xcodebuild clean test -workspace -scheme EnptyLibrary
When I run a XCTest test on an IOS Target device, the test runs but the simulator is not opened so I can follow the screens being displayed and the key strokes. And when I initiate a record for a test method, it just hangs and never runs or open a simulator.
Is anyone else experiencing these same issues running XCTest?
Is this legacy framework not working with XCode 16 by design?
Hello I have a problem with disappearing Icon logos in iOS 18.0.
as you can see on the picture below some logos disappeared from certain icons
I reported similar issue on the iOS 18 beta
I get the message as seen in the attached image. I recently enrolled in the Apple Developer program last month. Initially, I was working for a client and everything was working fine locally. Builds were executing fine and running as well in emulators and physical devices.
But when I archive the build and distribute it to TestFlight via AppStore Connect, I always get this error message as shown below. There are no warnings or errors in the console or in Xcode. I already took care of everything and all compliance related issues. I am not sure what even is wrong at this time.
I resubmitted the builds at-least 8 times but still getting same message.
Moreover, as a test run, I submitted a build containing a simple "Hello World" component as well. It's getting the same error. I have wrote to Apple Support as well but haven't heard back from them yet.
If anyone knows how to resolve this please please guide me. This is really annoying and frustrating now since testers are not able to test the application.
Hello,
I'm unable to run any test cases in Xcode 16 with the iOS 18 simulator.
Steps to Reproduce:
Create a new iOS project in Xcode 16 using the default iOS app template with the testing option checked.
Run any test or UI test case by clicking the "Play" icon in the Test navigator.
Xcode gets stuck at the "Testing" state indefinitely.
Environment:
macOS 15 beta 8
Xcode 16 beta 6
iOS 18 beta 7 simulator
Hello!
When running tests on iOS 17, the build succeeds but does not run on iOS 16. It consistently gets stuck on 'Testing'.
This issue does not occur on iOS 17.
Here's a video clearly demonstrating the problem:
https://youtu.be/-IbyaaIzh0I
This is a major issue for my game, because it's not meant to be played multiple times. My game is designed to only play once, so it really ruins the experience if it runs poorly until someone force quits or crashes the game.
Does anyone have a solution to this, or has encountered this issue of poor initial launch performance?
I made this game in Unity and I'm not sure if this is an Apple issue or a Unity issue.
Is it a good idea to automate API calls used in my mobile APP in XCtests and check if response is in expected format. I want to test all the API calls used inside my app at one place rather than testing each feature which internally calls that API. This way I want to sure that my API's are working
Dear Apple Developer
[Background]
We are developing a service running on test mode based on XCTest Framework to support streaming, remote and automation testing with iOS devices.
After we upgrade macOS Sonama and Xcode 15 version for upgrade XCTest for support iOS 17 around Jan-2024, we saw
We noticed that our running on test mode services stuck and hanging frequently after a period of time.
We have investigate and tried debug code and we found that main thread stuck and hanging when it call requesting snapshot of accessibility hierarchy for app. At the same time, we noticed that the application we were testing stuck and hanging too.
[Environment]
Application testing: Tiktok
MacOS: Sonoma 14.5
Xcode: Version 15.4 (15F31d)
Device test: iPhone 12 (iOS 14.8.1)
Log detail:
t = 1524.15s Wait for com.ss.iphone.ugc.Ame to idle
t = 1536.54s Find the Application 'com.ss.iphone.ugc.Ame'
t = 1536.54s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 1597.56s Find the Application 'com.ss.iphone.ugc.Ame' (retry 1)
t = 1597.56s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 1658.58s Find the Application 'com.ss.iphone.ugc.Ame' (retry 2)
t = 1658.58s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 1718.58s Collecting extra data to assist test failure triage
t = 1718.58s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 1778.59s Requesting snapshot of accessibility hierarchy for app with pid 509
2024-08-19 14:16:44.990260+0700 WebDriverAgentRunner-Runner[489:97809] Issue type: 0
2024-08-19 14:16:44.990428+0700 WebDriverAgentRunner-Runner[489:97809] Enqueue Failure: Failed to get matching snapshot: XCTPerformOnMainRunLoop work timed out after 60.0s ((null)) (null) 0 0
t = 1843.71s Find the Application 'com.ss.iphone.ugc.Ame'
t = 1843.71s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 1874.72s Find the Application 'com.ss.iphone.ugc.Ame' (retry 1)
t = 1874.72s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 1940.76s Find the Application 'com.ss.iphone.ugc.Ame' (retry 2)
t = 1940.77s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2005.80s Collecting extra data to assist test failure triage
t = 2005.80s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2066.58s Requesting snapshot of accessibility hierarchy for app with pid 509
2024-08-19 14:21:33.019582+0700 WebDriverAgentRunner-Runner[489:97809] Issue type: 0
2024-08-19 14:21:33.019687+0700 WebDriverAgentRunner-Runner[489:97809] Enqueue Failure: Failed to get matching snapshot: Unable to perform work on main run loop, process main thread busy for 30.0s ((null)) (null) 0 0
2024-08-19 14:21:33.020647+0700 WebDriverAgentRunner-Runner[489:97809] Issue type: 0
2024-08-19 14:21:33.020722+0700 WebDriverAgentRunner-Runner[489:97809] Enqueue Failure: No element snapshot found for Application 'com.ss.iphone.ugc.Ame'[0.00, 0.00] -> (200.0, 259.0) ((null)) (null) 0 0
2024-08-19 14:21:33.020801+0700 WebDriverAgentRunner-Runner[489:97809] *** Assertion failure in -[XCPointerEventPath initForTouchAtPoint:offset:], XCSynthesizedEventRecord.m:263
t = 2291.08s Find the Application 'com.ss.iphone.ugc.Ame'
t = 2291.08s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2352.10s Find the Application 'com.ss.iphone.ugc.Ame' (retry 1)
t = 2352.10s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2413.11s Find the Application 'com.ss.iphone.ugc.Ame' (retry 2)
t = 2413.11s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2473.12s Collecting extra data to assist test failure triage
t = 2473.12s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2533.13s Requesting snapshot of accessibility hierarchy for app with pid 509
2024-08-19 14:29:19.552744+0700 WebDriverAgentRunner-Runner[489:97809] Issue type: 0
2024-08-19 14:29:19.553054+0700 WebDriverAgentRunner-Runner[489:97809] Enqueue Failure: Failed to get matching snapshot: XCTPerformOnMainRunLoop work timed out after 60.0s ((null)) (null) 0 0
t = 2598.27s Find the Application 'com.ss.iphone.ugc.Ame'
t = 2598.28s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2659.29s Find the Application 'com.ss.iphone.ugc.Ame' (retry 1)
t = 2659.29s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2720.31s Find the Application 'com.ss.iphone.ugc.Ame' (retry 2)
t = 2720.32s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2780.33s Collecting extra data to assist test failure triage
t = 2780.33s Requesting snapshot of accessibility hierarchy for app with pid 509
t = 2840.34s Requesting snapshot of accessibility hierarchy for app with pid 509
2024-08-19 14:34:26.806686+0700 WebDriverAgentRunner-Runner[489:97809] Issue type: 0
2024-08-19 14:34:26.806828+0700 WebDriverAgentRunner-Runner[489:97809] Enqueue Failure: Failed to get matching snapshot: XCTPerformOnMainRunLoop work timed out after 60.0s ((null)) (null) 0 0
2024-08-19 14:34:26.808114+0700 WebDriverAgentRunner-Runner[489:97809] Issue type: 0
2024-08-19 14:34:26.808205+0700 WebDriverAgentRunner-Runner[489:97809] Enqueue Failure: No element snapshot found for Application 'com.ss.iphone.ugc.Ame'[0.00, 0.00] -> (200.0, 259.0) ((null)) (null) 0 0
2024-08-19 14:34:26.809241+0700 WebDriverAgentRunner-Runner[489:97809] *** Assertion failure in -[XCPointerEventPath initForTouchAtPoint:offset:], XCSynthesizedEventRecord.m:263
I'm used to wait for expectations when using XCTest, but I'm completely stumped by the seemingly-absent option for expecting some parts of my code to be called in Swift Testing 🤔
Consider the following:
protocol MyAPI {
func getData() async throws -> String
}
class MockAPI: MyAPI {
let stub: () async throws -> String
init(stub: @escaping () async throws -> String = { "hello" }) {
self.stub = stub
}
func getData() async throws -> String {
try await stub()
}
}
Which is being used in my view model:
class MyViewModel: ObservableObject {
private let api: MyAPI
@Published
var data: String
init(api: MyAPI) {
self.api = api
}
func refresh() async throws {
self.data = try await api.getData()
}
}
When I wrote tests in the past, I would simply override the stub of the MockAPI implementation and fulfill an expectation in there:
class MyViewModelTests: XCTestCase {
func testModelCallsAPIOnRefresh() async throws {
let expectCallsAPI = expectation("Model should call API")
let api = MockAPI {
expectCallsAPI.fulfill()
return "hello"
}
let model = MyViewModel(api: api)
try await model.refresh()
await fulfillment(of: [expectCallsAPI], timeout: 1)
}
}
How would I go about checking that my model does indeed call the API when using Swift Testing?
Hi,
I have an app developed with Go and Fyne and would like to test that on a few physical iOS devices. It runs fine with the simulator. I have created a Certificate and Identifier, registered a couple of devices and create a Provisioning Profile.
I somehow ended up with two teams in Xcode, a Personal Team (whatever that means) and a "company" team. I think the company team is being used with the associated certificate but that is not obviously trivial (to me).
No matter what I try, I can't get that Provisioning Profile installed (in Xcode I presume). It fails with "Failed to install one or more provisioning profiles on the device. Please ensure the provisioning profile is configured for this device. If not, please try to generate a new profile". I am absolutely sure that I generated that Provisioning Profile for the couple of devices I registered. I assume that "device" is the device currently selected in the Devices and Simulators window of Xcode.
I have tried it so many times now getting the exact same result that I am getting concerned that I'm now qualify for Einstein's description of insanity.
I don't have a "native" Xcode project as the app is generated with/by Fyne so I used codesign to sign the app.
Any suggestions how I can keep my sanity are most welcome :-)
Hello everyone! I have encountered a problem that the print function does not work correctly in any browser on devices with iOS, if you save a web page in PDF format, then the hyperlinks from this page are not saved, they just disappear, maybe this is not very important problem for everyone, but I find this an inconvenient problem.