Skip to content

Document the testing process better for new contributors #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ 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 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
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!
Expand Down
Loading