From 0f2871471cc370ce1ff41f7580bf8bc28521a8fc Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Fri, 2 May 2025 01:37:26 +0900 Subject: [PATCH 1/3] Document the testing process better for new contributors --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49635f1..2238c35 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,6 +33,20 @@ variety of use cases, much like MapKit's SwiftUI views. ## Testing +You can run the test suite from Xcode using the standard process: +Product menu > Test, or Cmd + U. +If you're having trouble getting a test option / there are no tests, +make sure that the `MapLibreSwiftUI-Package` target is active. + +Most of the unit tests are pretty straightforward, but you may notice a few things besides the vanilla testing tools. +We employ snapshot tests liberally to record the state of objects after some operations. +In case you change somtehing which triggers a snapshot change, +you'll get a test failure with some nominally useful info (usually paths to the new and old snapshot). + +To record a new snapshot, you can either delete the existing snapshot file on disk +or pass a keyword argument `record: true` to the assertion function. +Then re-run the tests and a new snapshot will be generated (tests will fail one last time with a note that a new snapshot was recorded). + We do not currently have full UI tests. These are a bit tricky due to the async nature of MapLibre and integrating this into an Xcode UI test is challenging. If you have any suggestions, we welcome them! From b7ae4c984bffb6f364447b9be169e341a464d47b Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Fri, 2 May 2025 02:10:05 +0900 Subject: [PATCH 2/3] Fix typo Co-authored-by: Jacob Fielding --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2238c35..ac65eb7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ make sure that the `MapLibreSwiftUI-Package` target is active. Most of the unit tests are pretty straightforward, but you may notice a few things besides the vanilla testing tools. We employ snapshot tests liberally to record the state of objects after some operations. -In case you change somtehing which triggers a snapshot change, +In case you change something which triggers a snapshot change, you'll get a test failure with some nominally useful info (usually paths to the new and old snapshot). To record a new snapshot, you can either delete the existing snapshot file on disk From e4e9682dedf9e1b5a9e46909145f59eeff53e763 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Fri, 2 May 2025 02:13:12 +0900 Subject: [PATCH 3/3] Link out to the snapshot testing github repo --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac65eb7..090d4fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,6 +47,8 @@ To record a new snapshot, you can either delete the existing snapshot file on di or pass a keyword argument `record: true` to the assertion function. Then re-run the tests and a new snapshot will be generated (tests will fail one last time with a note that a new snapshot was recorded). +You can learn more about the snapshot testing library we use [here](https://github.com/pointfreeco/swift-snapshot-testing). + We do not currently have full UI tests. These are a bit tricky due to the async nature of MapLibre and integrating this into an Xcode UI test is challenging. If you have any suggestions, we welcome them!