Getting started on Testing when using CoreData and CloudKit

I'm restarting my app using CoreData and CloudKit and want to implement testing before I get too far and it becomes unmanageable. Is there a good tutorial anyone has found for testing when using SwiftUI (macOS and iOS but not storyboards).

Thanks. It seems overwhelming right now and I don't know where to start. :)

Replies

I'm curious as to what you found, I have the exact same question. Also sort of fascinating, I proposed the question to ChatGPT, and it provided links that sounded promising, but all of which were 404 not found links:
___"Test-Driven Development with CloudKit and SwiftUI" by Craig Clayton on the Ray Wenderlich website: This tutorial covers how to use Test Driven Development with CloudKit and SwiftUI. It includes examples of setting up a test environment, creating mock data, and writing unit tests for CloudKit code. Link: https://www.raywenderlich.com/9700429-test-driven-development-with-cloudkit-and-swiftui

"Testing with CloudKit" by John Sundell on the Swift by Sundell website: This article covers how to test CloudKit code using XCTest. It includes examples of mocking CloudKit dependencies, writing unit tests for CloudKit operations, and using test doubles. Link: https://www.swiftbysundell.com/articles/testing-with-cloudkit/

"Unit Testing CloudKit Operations in Swift" by Kushagra Verma on the Medium website: This article covers how to use Test Driven Development to write unit tests for CloudKit operations such as fetching records and handling errors. It includes examples of setting up a test environment, creating mock data, and writing unit tests using XCTest. Link: https://kushagra.dev/posts/unit-testing-cloudkit-operations-in-swift/

"CloudKit and Test Driven Development" by David Kittell on the Thoughtbot website: This article covers how to use Test Driven Development with CloudKit. It includes examples of writing unit tests for CloudKit operations using XCTest, and using mock objects to isolate CloudKit code from other parts of your app. Link: https://thoughtbot.com/blog/cloudkit-and-test-driven-development___

Each of these sounds tantalizingly like exactly what I'm looking for, but I have been unsuccessful finding the information anywhere online, even given the author's names and looking on the Swift by Sundell website, etc. If you found anything that provides guidance or wisdom, please let me know! Many thanks.

Bob

  • I've actually put off CoreData/CloudKit testing for now as I wasn't able to find anything. With WWDC coming up maybe they'll have a solution? Hopefully.

Add a Comment