Hello, everyone!
I'm currently working on creating tests for a study project in Swift. My current task is to create a test to check if a file is saved correctly.
The workflow in the app is as follows:
Launch the app.
Open a file within the app.
Modify the file.
Save it inside the app.
Save it to the Files app.
I need to verify if the saved file in the Files app is identical to a base file stored in the app bundle.
Initially, I thought I could solve this by creating a UI test, which I've already implemented up to a certain point. The UI test successfully navigates through the workflow steps until it's time to compare the saved file with the base file.
The problem is that I cannot open a saved file from the Files app in a UI test because it operates in a sandboxed environment and cannot interact with external app scopes.
So, my question is: What should I do in this case?
Would it be better to create a unit test specifically for testing the save function and ensure the UI test only verifies if the expected filename exists in the Files app?
I would prefer an end-to-end (E2E) test that covers the entire workflow, but it seems Swift splits tests into Unit and UI test groups, making this approach less straightforward.
Any suggestions or best practices would be greatly appreciated!
Testing
RSS for tagDetect issues like logic failures, UI problems, and performance regressions by running tests on your app.
Posts under Testing tag
109 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
In my macOS app I have a SwiftUI list that starts like this:
List(selection: $selection) {
HStack {
Label("Staging", systemImage: "arrow.up.square")
Spacer()
WorkspaceStatusBadge(unstagedCount: model.statusCounts.unstaged,
stagedCount: model.statusCounts.staged)
}
(where WorkspaceStatusBadge is a custom view that just contains a Text)
I'm trying to set the accessibility ID of that first cell so I can find it in XCUITest. If I apply the accessibilityIdentifier() modifier to the HStack, it instead sets the ID of the two static text elements inside it, and the cell still has no ID.
I could find the cell based on the ID of the child staticText, but I have some other cases where this doesn't work as well.
If I use .accessibilityElement() on the HStack, then XCUI sees a cell containing a Group element with the ID. This might be workable, but it's certainly not ideal.
So how do I set the ID of the cell itself?
Hi,
Testflight app is showing "Couldn't Load Apps. TestFlight is currently unavailable. Try again." error each time when i trying to open it last 2 days. I'm tried to uninstall/re-install TestFlight app, but error still remain.
Can anyone confirm this error?
Devices which is affected with the same error: iPad 6 (2018) / iOS 17.7, iPad Pro / iOS 16.7.9, iPad Air 2 / iOS 15.8.2
All tests build and run locally just fine. Xcode Cloud can build my code, but always fails to run tests with the below errors. How can I even begin to troubleshoot this?
I think my setup is pretty straightforward. Just a simple test plan that execute some unit tests with Swift Testing.
Run command: 'xcodebuild test-without-building -destination 'platform=iOS Simulator,id=1EB80431-1A0B-4AD8-8EA6-968EA09C3F23' -resultBundleVersion 3 -resultBundlePath /Volumes/workspace/resultbundle.xcresult -resultStreamPath /Volumes/workspace/tmp/resultBundleStream679e7ce9-a095-4be5-8dfa-4c9df982e547.json -IDEPostProgressNotifications=YES -DTDKDisableSymbolCopying=YES -test-timeouts-enabled YES -maximum-test-execution-time-allowance 1800 -hideShellScriptEnvironment -maximum-parallel-testing-workers 8 -testProductsPath /Volumes/workspace/TestProducts.xctestproducts'
(6378) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal ill before starting test execution.))
May be related to:
https://developer.apple.com/forums/thread/725660
Hi developers,
I'm searching for a kind of way of working to develop my apps on a different machine than testing and final building.
For development I have a MacBook Pro m4 and for testing I want to outsource this to a Mac mini m1. I was searching for a solution and also contacted the support, but the answer wasn't really helpful.
Any ideas how to setup this configuration to automate this kind of tests?
Thanks a lot!
So this is a long shot. My apple device has been hacked. In March, my credit card, which is in apple pay, started to get used, until May. It was used for thousands of dollars. In July i discovered installed and generally “invisible” files in the files app. I’ve called All IPhone that was a contact file.
when i started deleting everything from my phone, all messages and photos and accounts, it became obvious i was signed into the app store in a sandbox account i never signed up for or into. I believe this is one method by device as compromised through apple.
does anyone have any ideas on if it would be possible for a hacker to use my apple pay through some scam developer who had initiated a testing agreement between myself and them?
I have uploaded an beta version into Testflight and added few member under internal testing. However, no one can receive an internal testing invitation email. I tried to re-upload a new version and re-create a new internal testing group but no luck.
Thank you so much.
My current project is similar to Facebook In size. Is there an alternative to MVVM that will produce the same outcome without so many files. Performance is very poor.
Hi everyone,
I'm getting this error when I try to test my app on my iPhone.
If any other developers who have gotten the same error could help, that would be great.
Thanks, Oliver
Background:
We are developing an App for both Windows, Android and iOS.
Our process is that virtually every pull request must be tested by a tester before being pushed to the main branch.
Up until now, we have been distributing the 3 versions to our testers via Microsoft AppCenter. Unfortunately, AppCenter is stopping per 31 March 2025 and we are looking for an alternative method.
As the Play Store isn't really useful for us for distributing android apps (a test build can take a few hours before appearing according to their documentation), we may have to look into setting up our own distribution website for our apps.
As such I was wondering, rather then using Test Flight for iOS, to also distribute the iOS app via our own website to our testers as it would be easier for our testers to have everything together.
Even though our apps are build and signed using an "ad hoc" provisioning profile, it's still not possible to just install the .IPA files just by downloading it.
The actual question:
So my question is, how can I install our app to our testers from a website. Do I have to set the link as something specific?
Or has AppCenter been using a trick not available to us mere mortals?
To clarify: I am only asking for distributing to our testers using the ad hoc provisioning profile with the test devices registers at apple. I am NOT asking for distribution to end users, that goes via the App Store as usual.
When I try to install packages through spm it doesn't find the packages.swift file, and with pods I have problems with Foundation. Trying to install Firebase shows that many pods have issues with double quotes. I don't know if it's my PC using everything updated or what, but I'm having a lot of problems and I haven't been able to reconcile my first application. I don't want to give up, and I would like some advice, since you have managed it, I would appreciate some help. I have followed tutorials, cases of people with similar problems, but it always throws some error.
My pc is mac m1
Using Xcode 16.1 (16B40).
When adding a test suite with tests in an extension to an enum:
The tests can be compiled and executed as expected (by clicking the diamond), and e.g. "Reveal in Test Navigator" works as expected. But after the tests have been executed, there is no check or cross diamond icons in the Test Navigator,
If I right click the empty diamond in the margin for one of the tests and click "Jump to report", Xcode shows an alert saying "No test found matching the identifier MyEnumNameSpace/SomeTests/example()", which is very strange.
Steps to reproduce:
Create a new iOS app project using SwiftUI and Swift Testing.
Add a file in the app target defining an enum namespace:
public enum NamespaceDefinedInSomeApp {}
Replace the content of the already created …Tests.swift file with:
import Testing
@testable import SomeApp
// This works as expected:
@Suite struct SomeTests {
@Test func example() async throws {
#expect(true)
}
}
// This compiles and executes but acts strange:
extension NamespaceDefinedInSomeApp {
@Suite struct SomeTests {
@Test func example() async throws {
#expect(true)
}
}
}
// This compiles and executes but acts strange:
enum AnotherNamespace {}
extension AnotherNamespace {
@Suite struct SomeTests {
@Test func example() async throws {
#expect(true)
}
}
}
A user gave me the crash log on his M4 machine when he first launches the app. I have M1 and my app works fine, which begs the question, why M4 has the crash! This is my app the I developed since 2011 until now.
Any hints will be appreciated or anyone has similar issues like to share?
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Incident Identifier: DA1CEECB-28D4-40A9-8F0C-7125812084F4
CrashReporter Key: FB8A5DBB-7140-D370-AC72-EC158266383C
Hardware Model: Mac16,3
Process: Stocks Live [5506]
Path: /private/var/folders/*/Stocks Live.app/Stocks Live
Identifier: com.cinnamonmobile.StocksLive
Version: 34.2 (34.2.0)
AppStoreTools: 16B39
AppVariant: 1:MacFamily20,1:18
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.cinnamonmobile.StocksLive [2018]
Date/Time: 2024-11-27 12:41:48.0456 -0500
Launch Time: 2024-11-27 12:41:47.5710 -0500
OS Version: macOS 15.1.1 (24B2091)
Release Type: User
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_MEMORY_ERROR at 0x0000000120034000
Exception Codes: 0x000000000000000a, 0x0000000120034000
VM Region Info: 0x120034000 is in 0x120034000-0x120038000; bytes after start: 0 bytes before end: 16383
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
CoreAnimation 120030000-120034000 [ 16K] rw-/rwx SM=PRV
---> mapped file 120034000-120038000 [ 16K] r--/rw- SM=COW Object_id=14630bfe
CoreAnimation 120038000-12003c000 [ 16K] r--/r-- SM=PRV
Termination Reason: SIGNAL 10 Bus error: 10
Terminating Process: exc handler [5506]
Triggered by Thread: 0
Kernel Triage:
decmpfs - (arg = 0x80000001) compressor is not registered
APFS - (arg = 0x200040) Pagein of compressed inode failed
VM - (arg = 0x190000002d) Filesystem pagein returned an error in vnode_pagein
VM - (arg = 0x0) Page has error bit set
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 CoreFoundation 0x18803f48c __CFStringCreateImmutableFunnel3 + 716
1 FincancialCoreFrameWork 0x10358d3c4 -[MOStringDocument loadFromContents:ofType:error:] + 156
2 UIKitCore 0x1ba34a67c __32-[UIDocument readFromURL:error:]_block_invoke + 104
3 libdispatch.dylib 0x187e20658 _dispatch_client_callout + 20
4 libdispatch.dylib 0x187e2fdb0 _dispatch_async_and_wait_invoke + 92
5 libdispatch.dylib 0x187e20658 _dispatch_client_callout + 20
6 libdispatch.dylib 0x187e2ef68 _dispatch_main_queue_drain + 980
7 libdispatch.dylib 0x187e2eb84 _dispatch_main_queue_callback_4CF + 44
8 CoreFoundation 0x1880f8e60 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
9 CoreFoundation 0x1880b8a4c __CFRunLoopRun + 1996
10 CoreFoundation 0x1880b7bc4 CFRunLoopRunSpecific + 588
11 HIToolbox 0x193529f64 RunCurrentEventLoopInMode + 292
12 HIToolbox 0x19352fd54 ReceiveNextEventCommon + 636
13 HIToolbox 0x19352feb8 _BlockUntilNextEventMatchingListInModeWithFilter + 76
14 AppKit 0x18bbe398c _DPSNextEvent + 660
15 AppKit 0x18c523ddc -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
16 AppKit 0x18bbd6a64 -[NSApplication run] + 480
17 AppKit 0x18bbad2e8 NSApplicationMain + 888
18 AppKit 0x18bdfb7f4 _NSApplicationMainWithInfoDictionary + 24
19 UIKitMacHelper 0x1a28f8b38 UINSApplicationMain + 972
20 UIKitCore 0x1b99de3a8 UIApplicationMain + 148
21 Stocks Live 0x102bcc058 0x102bc4000 + 32856
22 dyld 0x187c50274 start + 2840
Thread 1:: Dispatch queue: UIDocument File Access
0 libsystem_kernel.dylib 0x187f93b8c __ulock_wait + 8
1 libdispatch.dylib 0x187e21048 _dlock_wait + 56
2 libdispatch.dylib 0x187e20dfc _dispatch_thread_event_wait_slow + 56
3 libdispatch.dylib 0x187e2ffc4 __DISPATCH_WAIT_FOR_QUEUE__ + 368
4 libdispatch.dylib 0x187e2fb70 _dispatch_sync_f_slow + 148
5 UIKitCore 0x1ba351384 -[UIDocument(UIDocumentInternal) _performBlock:synchronouslyOnQueue:] + 76
6 UIKitCore 0x1ba347ff0 __40-[UIDocument openWithCompletionHandler:]_block_invoke + 588
7 libdispatch.dylib 0x187e1e8f8 _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x187e20658 _dispatch_client_callout + 20
9 libdispatch.dylib 0x187e27c60 _dispatch_lane_serial_drain + 744
10 libdispatch.dylib 0x187e28768 _dispatch_lane_invoke + 380
11 libdispatch.dylib 0x187e337e8 _dispatch_root_queue_drain_deferred_wlh + 288
12 libdispatch.dylib 0x187e33034 _dispatch_workloop_worker_thread + 540
13 libsystem_pthread.dylib 0x187fcf3d8 _pthread_wqthread + 288
14 libsystem_pthread.dylib 0x187fce0f0 start_wqthread + 8
Thread 2:
0 libsystem_pthread.dylib 0x187fce0e8 start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x187fce0e8 start_wqthread + 0
// Füge OrderRow hinzu
struct OrderRow: View {
let order: Order
var body: some View {
VStack(alignment: .leading, spacing: 8) {
HStack {
Text("Tisch \(order.tableNumber)")
.font(.headline)
Spacer()
Text(order.status.rawValue)
.font(.caption)
.padding(.horizontal, 8)
.padding(.vertical, 4)
.background(order.status.color.opacity(0.2))
.foregroundColor(order.status.color)
.cornerRadius(8)
}
Text(order.timestamp, style: .time)
.font(.caption)
.foregroundColor(.gray)
ForEach(order.items) { item in
Text("\(item.quantity)x \(item.item.name)")
.font(.subheadline)
}
HStack {
Spacer()
Text(String(format: "%.2f €", order.totalAmount))
.bold()
}
}
.padding()
.background(Color.white)
.cornerRadius(12)
.shadow(radius: 2)
}
}
struct MenuItemRow: View {
let item: MenuItem
var body: some View {
HStack {
Text(item.name)
.font(.headline)
Spacer()
Text(String(format: "%.2f €", item.price))
.font(.subheadline)
}
.padding()
}
}
struct MenuItemsView: View {
@Binding var selectedItems: [OrderItem]
@Environment(.dismiss) private var dismiss
func filteredItems(for category: MenuCategory) -> [MenuItem] {
return sampleMenuItems.filter { $0.category == category }
}
func addItemToOrder(_ item: MenuItem) {
if let index = selectedItems.firstIndex(where: { $0.item.id == item.id }) {
selectedItems[index].quantity += 1
} else {
selectedItems.append(OrderItem(item: item, quantity: 1))
}
}
var body: some View {
NavigationView {
List {
ForEach(MenuCategory) { category in
Section(header: Text(category.rawValue)) {
let filteredItems = sampleMenuItems.filter
ForEach(filteredItems) { item in
}
MenuItemRow(item: sampleMenuItems.filter) {
addItemToOrder
}
}
}
}
}
.navigationTitle("Menü")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button("Fertig") {
dismiss()
}
}
}
}
}
}
// Sample Menü-Items
let sampleMenuItems: [MenuItem] = [
MenuItem(name: "Cola", description: "0,33l", price: 3.50, category: .drinks, image: "cola"),
MenuItem(name: "Sprite", description: "0,33l", price: 3.50, category: .drinks, image: "sprite"),
MenuItem(name: "Bier", description: "0,5l", price: 4.00, category: .drinks, image: "beer"),
MenuItem(name: "Nachos", description: "mit Käsesauce", price: 5.50, category: .snacks, image: "nachos"),
MenuItem(name: "Pommes", description: "mit Ketchup", price: 4.50, category: .food, image: "fries"),
MenuItem(name: "********", description: "alkoholfrei", price: 6.50, category: .specials, image: "********")
]
struct NewEventView: View {
var body: some View {
Text("New Event")
}
}
struct EventManagementView: View {
var body: some View {
Text("Event Management")
}
}
struct OrderRow: View {
var order: String
var body: some View {
Text("Order: (order)")
}
}
#Preview {
ContentView()
}
I have tests where I connect to NEPacketTunnelProvider. I run tests with circleci and fastlane, on self hosted intel and arm macs. I updated macs from macOS 13 to macOS 14 and the tests on arm stopped connecting, while the same tests on intel kept working as usual. Moreover, I noticed the tests don't work when run from circleci and fastlane. If I cancel the job and click "connect" myself on the app that stayed hanging from the cancelled tests, the connection will succeed. But if the tests are running, the connection will fails. Running the tests from xcode succeeds too.
These are the logs from the tunnel. Could you suggest me where to dig? Or maybe you can see the issue from the logs?
Tunnel logs when they fail
Our use case is that we need to run a CLI script (on Mac) to set up backend configuration before each test case (UI test on real iOS device). The setup logic is test specific, so using pre-build scripts is not an option.
Is this support in any way or what are best practices around such a setup?
Ideally, we would still be able to execute the tests from within Xcode.
Our use case is that we need to run a CLI script (on Mac) to set up some backend configuration for a UITest that then runs on iOS (simulator or actual device). The setup logic is test specific so using pre-build scripts is not a an option. Is that support in any way or what would be alternatives to go about this.
I’m currently trying to localize one of my Mac apps for Right-to-Left languages.
In Xcode, to test this, I set the language to ‘Arabic’ in the scheme, which then displays the language and mirrors the layout accordingly.
I have two questions about this:
macOS titlebar buttons: In the title bar at the top, shouldn’t the Close and Minimize buttons also be on the right side (mirrored)? How can I test this?
Numerals: My UI still displays Latin numerals (123). I know this is correct in some Arabic-speaking regions, but I’d also like to test cases where Arabic-Indic numerals (١٢٣) are used. Is there a way to configure the scheme to test this?
Hello,
I am currently developing an iOS application that leverages FinanceKit to access transaction history. I have already enabled FinanceKit in my developer account, but I am encountering challenges when trying to test the transaction history feature.
Could anyone guide me on the best practices or specific steps needed to effectively test FinanceKit’s transaction history in a development environment? Any insights on mock data handling, API responses, or potential limitations during testing would be greatly appreciated.
Thank you in advance for your help!
How I can I have both versions of the app installed on the same phone? 1 for testing and 1 that’s live to see current version users are using?
I had this setup before but now TestFlight installs replace the live version instead of the test version.