Skip to content

Commit 1ac5cf7

Browse files
Document the testing process better for new contributors (#86)
* Document the testing process better for new contributors * Fix typo Co-authored-by: Jacob Fielding <[email protected]> * Link out to the snapshot testing github repo --------- Co-authored-by: Jacob Fielding <[email protected]>
1 parent 973d358 commit 1ac5cf7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ variety of use cases, much like MapKit's SwiftUI views.
3333

3434
## Testing
3535

36+
You can run the test suite from Xcode using the standard process:
37+
Product menu > Test, or Cmd + U.
38+
If you're having trouble getting a test option / there are no tests,
39+
make sure that the `MapLibreSwiftUI-Package` target is active.
40+
41+
Most of the unit tests are pretty straightforward, but you may notice a few things besides the vanilla testing tools.
42+
We employ snapshot tests liberally to record the state of objects after some operations.
43+
In case you change something which triggers a snapshot change,
44+
you'll get a test failure with some nominally useful info (usually paths to the new and old snapshot).
45+
46+
To record a new snapshot, you can either delete the existing snapshot file on disk
47+
or pass a keyword argument `record: true` to the assertion function.
48+
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).
49+
50+
You can learn more about the snapshot testing library we use [here](https://github.com/pointfreeco/swift-snapshot-testing).
51+
3652
We do not currently have full UI tests.
3753
These are a bit tricky due to the async nature of MapLibre and integrating this into an Xcode UI test is challenging.
3854
If you have any suggestions, we welcome them!

0 commit comments

Comments
 (0)