Jon Reid · @qcoding
1025 followers · 517 posts · Server iosdev.space

Stay Ahead of Bugs: How XCTests Can Keep Your iOS App Leak-Free!
Detect memory leaks in your app using addTeardownBlock and a custom XCTestCase extension.

qualitycoding.org/swift-memory

#swift #xctest

Last updated 1 year ago

Angu · @angu
3 followers · 9 posts · Server techhub.social

Since XCTest dose not support async expressions in its assert functions I released SwiftAsyncAsserts to fill that gap.

Write more readable testing code for your async APIS in Swift with SwiftAsyncAssert Swift package.

github.com/angu-software/Swift

#swift #xctest #asyncawait #unittest

Last updated 1 year ago

Jaanus Kase · @jaanus
356 followers · 610 posts · Server mastodon.justtact.com

I’m having trouble with Pointfreeco’s snapshot testing. Tests run and complete fine, but there’s a delay at the end of the test process. I can’t figure out where it’s coming from or what causes it. Reduced to a very simple fully reproducible example in my environment.

Anyone have any ideas?

github.com/pointfreeco/swift-s

#swift #swiftui #xctest #snapshottesting

Last updated 1 year ago

Jaanus Kase · @jaanus
346 followers · 572 posts · Server mastodon.justtact.com

Point-Free has an excellent snapshot-testing library that lets you unit test your view snapshots (screenshots). It does not work with Xcode Cloud out of the box, because test runner environment in Xcode Cloud does not have access to the source repository, which snapshot-testing assumes by default.

Here’s my solution for making snapshot-testing work correctly with Xcode Cloud. jaanus.com/snapshot-testing-xc

#swift #xctest #snapshottesting #xcodecloud

Last updated 1 year ago

Jon Reid · @qcoding
915 followers · 326 posts · Server iosdev.space

enumerations: How to write assertions to verify them? What about associated values? qualitycoding.org/unit-test-en

#swift #xctest

Last updated 1 year ago

Łukasz Rutkowski · @luckkerr
102 followers · 178 posts · Server mastodon.world

Cool trick I learned for UI tests in Xcode. You can set "TZ" launch environment value to force the app to use provided time zone. Useful when testing layout that displays formatted dates.

developer.apple.com/forums/thr

#iosdev #xctest #uitesting #Swift

Last updated 1 year ago

Jon Reid · @qcoding
903 followers · 286 posts · Server iosdev.space

enumerations: How to write assertions to verify them? What about associated values? qualitycoding.org/unit-test-en

#swift #xctest

Last updated 2 years ago

Jon Reid · @qcoding
888 followers · 207 posts · Server iosdev.space

enumerations: How to write assertions to verify them? What about associated values? qualitycoding.org/unit-test-en

#swift #xctest

Last updated 2 years ago

Jon Reid · @qcoding
867 followers · 159 posts · Server iosdev.space

In , I declare all test methods as throws because it makes life easier, and there's no penalty. Can I do the same with MainActor at the class level? They're already running on the main thread, so this seems similar.

#xctest

Last updated 2 years ago

Paul Samuels · @paulio87
4 followers · 8 posts · Server hachyderm.io

Xcode 11 added the `XCTUnwrap` test helper. This post discusses an `XCTCast` method to encourage a safe pattern for type casting during tests.

paul-samuels.com/blog/2023/03/

#swift #iOS #iosdev #xcode #xctest

Last updated 2 years ago

Jon Reid · @qcoding
689 followers · 361 posts · Server techhub.social

How can you write assertions to verify optionals, getting the most from failures? qualitycoding.org/unit-test-op

#xctest #swift #SwiftLang #unittests

Last updated 2 years ago

Collin Donnell · @collin
833 followers · 951 posts · Server ruby.social

I don’t know if I’m the person to make it, but I feel like a package to make doing all of the normal testing things doesn’t give you would be pretty amazing.

The equivalent would be how uses Minitest (by default) but then also adds a bunch of stuff of its own to make testing web apps easy.

#swift #xctest #rails

Last updated 2 years ago

Duncan Babbage · @babbage
255 followers · 368 posts · Server iosdev.space

FB11933090: Provide option to follow Test Plan order in initializing Test Targets irrespective of "Run in Parallel" status

#xcode #xctest

Last updated 2 years ago

Jon Reid · @qcoding
562 followers · 231 posts · Server techhub.social

How do you test a custom test assertion? It depends. Usually, by hand, unless… stackoverflow.com/a/74880885/2

#SwiftLang #xctest

Last updated 2 years ago

Duncan Babbage · @babbage
219 followers · 253 posts · Server iosdev.space

If there's anyone out here who uses the framework to run UI tests via and is using it with I'd love your input on this issue, of a control that is tappable in practice, and via the Accessibility Inspector, but not in my KIF test: github.com/kif-framework/KIF/i

#kif #xctest #swiftui

Last updated 2 years ago

Duncan Babbage · @babbage
159 followers · 115 posts · Server iosdev.space

Sure wish there was a decent way to create parameterized unit tests. I've got an array of test data, want to run the same method on each of about ten items and assert that a particular outcome occurs.

Found this approach but too much of a kludge for me:
kazaimazai.com/parametrized-xc

Not sure whether to just duplicate ten tests, one for each test data item, or to put a for...in in an XCTest and deal with the lack of specificity for failures. Hgn.

#xctest #swift #unittesting

Last updated 2 years ago