Skip to content

Conversation

@d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable:

Summary

This PR does 3 things to enable the team to start adopting Swift Testing:

  • It adds data loading test helpers for Swift Testing so that new tests can use let context = try await load(catalog: ...) etc.
  • It adds some very minimal draft recommendations on things to think about when writing new tests and when updating existing tests from XCTest to Swift Testing
  • It updates a few existing tests to Swift Testing so that there's something existing to look at for the next person who either adds a new test or updates an existing test.

Dependencies

None

Testing

Nothing in particular. This is a test-only / documentation-only change.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added Updated tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

Copy link
Member

@heckj heckj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ignore if it's not useful - just saw the PR and stopped in to look)

- Prefer small test inputs that ideally use a virtual file system for both reading and writing.
- Consider using parameterized tests if you're making the same verifications in multiple configurations or on multiple elements.
- Think about what information would be helpful to someone else who might debug that test case if it fails in the future.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't quite sure what it is that I should do with the thinking about this. I get the reason you're asking for the consideration, but am unsure of how to apply that consideration into a test. Any suggestions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added both some more content and a couple of examples to this list item in 82c7138

We recommend that you use [Swift Testing](https://developer.apple.com/documentation/testing) when you add new tests.
Currently there are few existing tests to draw inspiration from, so here are a few recommendations:
- Prefer small test inputs that ideally use a virtual file system for both reading and writing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any notes or internal docs on what functions to use, or examples to reference, that use the virtual file system setup? That would be great to point to, if we can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can probably update each bullet to include an example that's both using Swift Testing and one that uses XCTest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added one ore more additional paragraphs of explanation in 82c7138

I don't know if that made it too long but I felt that it was better to err in that direction.

@d-ronnqvist d-ronnqvist marked this pull request as ready for review December 16, 2025 15:30
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants