#swifttesting β Public Fediverse posts
Live and recent posts from across the Fediverse tagged #swifttesting, aggregated by home.social.
-
#buildInPublic #iosDev #coreData #swiftTesting
So I now have a start at a merge strategy I can test. Note that in the case of UUID conflicts between inbound and existing entities Iβm taking the inbound UUID, so that if I modify the local storage it doesn't trigger another modification on the remote - a βsync loopβ. It is still possible to get duplicates locally by creating a new Tune (with a UUID) and then modifying user data to be identical to an existing Tune with a different UUID.
8/n -
#buildInPublic #iosDev #coreData #swiftTesting
new merge rule:
if inbound has UUID {
if there is existing with same UUID {
update existing with user data from most recently modified
} else { //no UUID match
if existing with same user data {
update existing with incoming UUID
} else { //no user data match
insert new with incoming UUID and user data
}
}
} else {//no incoming UUID
insert with new UUID
}
7/n -
#buildInPublic #iosDev #coreData #swiftTesting
To see if inbound changes apply, I need an invariant identifier so I can tell if I've seen this object before. I don't have one, so I need to add a UUID
6/n
-
#buildInPublic #iosDev #coreData #swiftTesting
Directly editable attributes are displayName, isFavourite and Notes, others are set by the app. To properly merge logic I must decide
- is an inbound Tune identical to an existing one
- should changes to an inbound tune apply to an existing one.The rule will be:
A - an inbound tune with identical displayName+notes to an existing one is considered identical
B - isFavourite will be set if either the existing or inbound tune has it set5/n
-
#buildInPublic #iosDev #coreData #swiftTesting
So the obvious next step is to be able to import Tune - they're my first entity, and in the real app Tunes can be imported from existing datastores and edited via a text editor.
In my existing basic data model I have:
Tune (inherited from Searchable)
collatingName : String
createdDateTime : Date
displayName : String
isFavourite : Boolean
modifiedDateTime : Date
notes : StringTune - extension
tuneSets : (many:many) to Set
4/n -
#buildInPublic #iosDev #coreData #swiftTesting
I'm going to need test data for the obvious CRUD scenarios, but also special cases to support merging sets and collections, as well as modifying a previously synced entity. The ability to import a text/JSON file would allow me to test merge logic in a repeatable way without worrying about actually setting up cloud sync.
3/n
-
Parameterized test output in SwiftTesting can be opaque. Conforming to πΆπ’π π‘πππππ π‘ππ‘πππππΆπππ£πππ‘ππππ produces clear descriptions of exactly which parameters caused a failure.
π: https://craftingswift.dev/articles/improve-swifttesting-parameterized-tests-with-customteststringconvertible/ by Felipe Espinoza
-
Parameterized test output in SwiftTesting can be opaque. Conforming to πΆπ’π π‘πππππ π‘ππ‘πππππΆπππ£πππ‘ππππ produces clear descriptions of exactly which parameters caused a failure.
π: https://craftingswift.dev/articles/improve-swifttesting-parameterized-tests-with-customteststringconvertible/ by Felipe Espinoza
-
Parameterized test output in SwiftTesting can be opaque. Conforming to πΆπ’π π‘πππππ π‘ππ‘πππππΆπππ£πππ‘ππππ produces clear descriptions of exactly which parameters caused a failure.
π: https://craftingswift.dev/articles/improve-swifttesting-parameterized-tests-with-customteststringconvertible/ by Felipe Espinoza
-
Parameterized test output in SwiftTesting can be opaque. Conforming to πΆπ’π π‘πππππ π‘ππ‘πππππΆπππ£πππ‘ππππ produces clear descriptions of exactly which parameters caused a failure.
π: https://craftingswift.dev/articles/improve-swifttesting-parameterized-tests-with-customteststringconvertible/ by Felipe Espinoza
-
#buildInPublic #iosDev #coreData #swiftTesting
Since Iβm eventually going to have to take a populated database and convert it from the old model to the new model, Iβm going to tag the current repo so I can come back to it and build my test data. I should build a test database now that covers all the cases, but I am pretty sure that Iβll think of more as I go along.
Nevertheless, first order of business is to build some infrastructure to populate the test database.
2/n
-
#buildInPublic #iosDev #coreData #swiftTesting
Since Iβm eventually going to have to take a populated database and convert it from the old model to the new model, Iβm going to tag the current repo so I can come back to it and build my test data. I should build a test database now that covers all the cases, but I am pretty sure that Iβll think of more as I go along.
Nevertheless, first order of business is to build some infrastructure to populate the test database.
2/n
-
#buildInPublic #iosDev #coreData #swiftTesting
Since Iβm eventually going to have to take a populated database and convert it from the old model to the new model, Iβm going to tag the current repo so I can come back to it and build my test data. I should build a test database now that covers all the cases, but I am pretty sure that Iβll think of more as I go along.
Nevertheless, first order of business is to build some infrastructure to populate the test database.
2/n
-
#buildInPublic #iosDev #coreData #swiftTesting
Since Iβm eventually going to have to take a populated database and convert it from the old model to the new model, Iβm going to tag the current repo so I can come back to it and build my test data. I should build a test database now that covers all the cases, but I am pretty sure that Iβll think of more as I go along.
Nevertheless, first order of business is to build some infrastructure to populate the test database.
2/n
-
#buildInPublic #iosDev #coreData #swiftTesting
Since Iβm eventually going to have to take a populated database and convert it from the old model to the new model, Iβm going to tag the current repo so I can come back to it and build my test data. I should build a test database now that covers all the cases, but I am pretty sure that Iβll think of more as I go along.
Nevertheless, first order of business is to build some infrastructure to populate the test database.
2/n
-
#buildInPublic #iosDev
Back to this after a hiatus of several weeks. Starting a new threadprevious thread is here https://mastodon.social/@Tom_frog/115686636425331266
I'm going to need to develop the alternate #coreData model described in the previous thread, then develop a data migration. Finally, Iβll need to sync and deduplicate. I will use the the #swiftTesting functions I added in the first phase to test the migration.
staying well away from AI since I want to actually understand what Iβm doing at the end.
1/n
-
#buildInPublic #iosDev
Back to this after a hiatus of several weeks. Starting a new threadprevious thread is here https://mastodon.social/@Tom_frog/115686636425331266
I'm going to need to develop the alternate #coreData model described in the previous thread, then develop a data migration. Finally, Iβll need to sync and deduplicate. I will use the the #swiftTesting functions I added in the first phase to test the migration.
staying well away from AI since I want to actually understand what Iβm doing at the end.
1/n
-
#buildInPublic #iosDev
Back to this after a hiatus of several weeks. Starting a new threadprevious thread is here https://mastodon.social/@Tom_frog/115686636425331266
I'm going to need to develop the alternate #coreData model described in the previous thread, then develop a data migration. Finally, Iβll need to sync and deduplicate. I will use the the #swiftTesting functions I added in the first phase to test the migration.
staying well away from AI since I want to actually understand what Iβm doing at the end.
1/n
-
#buildInPublic #iosDev
Back to this after a hiatus of several weeks. Starting a new threadprevious thread is here https://mastodon.social/@Tom_frog/115686636425331266
I'm going to need to develop the alternate #coreData model described in the previous thread, then develop a data migration. Finally, Iβll need to sync and deduplicate. I will use the the #swiftTesting functions I added in the first phase to test the migration.
staying well away from AI since I want to actually understand what Iβm doing at the end.
1/n
-
#buildInPublic #iosDev
Back to this after a hiatus of several weeks. Starting a new threadprevious thread is here https://mastodon.social/@Tom_frog/115686636425331266
I'm going to need to develop the alternate #coreData model described in the previous thread, then develop a data migration. Finally, Iβll need to sync and deduplicate. I will use the the #swiftTesting functions I added in the first phase to test the migration.
staying well away from AI since I want to actually understand what Iβm doing at the end.
1/n
-
Interop between XCTest and Swift Testing? In the economy? It's more likely than you think.
Legitimately, I'm really excited for this. This'll enable much more consistent set of tooling that can easily be used in Swift Testing and in XCTest. It'll also make migrating from XCTest to Swift Testing much more simpler and much safer.
Go leave feedback at https://forums.swift.org/t/st-0021-targeted-interoperability-between-swift-testing-and-xctest/84965
-
Testing various permutations. I'm so glad I built the app in a way that this stuff doesn't need loading the GUI. I just have to go and look at all the outputted PDFs to sanity check them.
-
My solution uses a combination of macOS accessibility APIs and CGEvents directly (not keyDown), the former of which understands the whereabouts of the simulator, the latter for how to find the center of the viewport, set up a two-finger gesture by spawning at the center, option-dragging to a specified input distance, option-shift-dragging to a specified coordinate, then performing one or more gestures therein.
There has to be a better way!?
-
After Swift Testing added support for image attachments on apple platforms and windows platforms (insert 90s-era M$ insult here), they had realized they really should consolidate the different AttachableAs${PLATFORM_SPECIFIC_IMAGE_TYPE} protocols down into just a single AttachableAsImage protocol that each platform needs to conform to.
This is just large enough of a change to require evolution review, which I volunteered to manage! If you have thoughts, please add them to https://forums.swift.org/t/st-0017-consolidate-swift-testing-s-image-attachments-api-across-platforms/82815 (or message me on the swift forums).
The review period started some 30 minutes ago and runs through the end of October 30th!
-
-
Stream last night went well! Even learned some more about Swift Testing and serialization.
Here's my full recap https://jaywilson.zip/posts/2025/05/01-0608-pocket-budget/ -
Stream last night went well! Even learned some more about Swift Testing and serialization.
Here's my full recap https://jaywilson.zip/posts/2025/05/01-0608-pocket-budget/ -
Stream last night went well! Even learned some more about Swift Testing and serialization.
Here's my full recap https://jaywilson.zip/posts/2025/05/01-0608-pocket-budget/ -
Stream last night went well! Even learned some more about Swift Testing and serialization.
Here's my full recap https://jaywilson.zip/posts/2025/05/01-0608-pocket-budget/ -
Stream last night went well! Even learned some more about Swift Testing and serialization.
Here's my full recap https://jaywilson.zip/posts/2025/05/01-0608-pocket-budget/ -
Here's a post on making sure your SwiftTesting parameterised tests show up in the test navigator with nice names using `CustomTestStringConvertible`
https://paul-samuels.com/blog/2025/03/24/custom-test-string-convertible/
-
Attachments coming to Swift Testing in a review thread near you!
-
https://forums.swift.org/t/st-0008-exit-tests/78692
Exit tests! Death tests! Termination tests! In Swift Testing!
-
Just formally started the proposal process for two new Swift Testing features:
- Exit tests: https://forums.swift.org/t/pitch-exit-tests/78071
- Attachments: https://forums.swift.org/t/pitch-attachments/78072 -
It just hit me - because Swift Testing allows nesting of test suites, you can now have a master suite that contains a suite for testing internal implementation and a suite for testing public interface. So neat
-
Writing tests and improving my test coverage just helped me to find a few new issues I had, including code paths which weren't called but should have been.
Tests have saved me a lot of trouble.
I think I get more and more convinced that writing tests is very useful (still depending on the situation).Swift Testing makes this so much easier!
-
We created a little app for iOS and Mac developers to make it easier to migrate Swift XCTests to the Swift Testing framework: https://furnacecreek.org/testpiler/
-
Does anyone know how to make it so that #Xcode doesn't totally lose its shit every time I start a #SwiftTesting test? My current workaround is I have to pick a different tab in the left sidebar and then it settles down.
-
While awaiting the #GluSight app review, I finally focus on rewriting unit tests with the new Swift-Testing framework. Once most are done, Iβll replace Quick & Nimble, though they did serve their purpose. I also want to reduce dependencies, and #SwiftTesting is rather elegant.
-
It's my first challenge! As a side project, I created a website last month to publish English articles and wrote several articles so that I could post weekly. Today, I am happy to share my first article with you.
This article is an overview of confirmations, the first half of the contents of Swift Testing, about which I spoke in Japan.
https://laprasdrum.com/swift-testing/introducing-confirmation #swift #testing #swifttesting -
You are better off mocking URLSession than using a URLProtocol for mocking HTTP requests in your tests. If you donβt want to just take my word for it, you can read about why in my latest blog post: https://nicksloan.com/posts/mocking-urlsession/ #swift #testing #swifttesting
-
If folks are looking for using Swift Testing with Vapor, you'll encounter all sort of issues.
Here is something that might help you getting out of troubles:
https://github.com/vapor/vapor/issues/3236#issuecomment-2365300507It's using Lock from @mattiem ; of course. Who would imagine solving a swift concurrency issue without Matt work on it? π
-
Is #swifttesting not able to understand actor isolation? Here it's complaining that my Regex is not Sendable, but I already isolated it to a global actor.
-
As part of the iOSDevUK conference, there are workshops at the start and end of the conference. Daniel Steinberg @dimsumthinking is running a workshop on Exploring Swift Testing. See https://www.iosdevuk.com/
#iOS #Swift #SwiftTesting #iOSDevUK @iosdevuk
-
#SwiftTesting questions regarding SourceLocation:
- What is fileID for?
- How is column used?Are these fields for writing macros, and have nothing to do with SwiftTesting?
-
@polpielladev Good overview!
There is so much good stuff in #SwiftTesting :
Grouping and sub-grouping tests by suites, parameterized tests, adding traits like bug tracker links (!!) for context, disabling tests temporarily with βwithKnownIssueβ, β¦
But my favorite feature is the check for specific error types and cases. This in combination with typed throws in #Swift6 π€― -
#SwiftTesting in #Xcode16 looks so good π€©
And I enjoyed the #WWDC24 videos by Dorothy, Jonathan and Stuart. Although some of the shown examples in the videos didnβt make much sense, the capabilities and the intentions of the framework became clear to me.I'm hyped and so looking forward to use this!