Skip to content

Don't emit JSON blobs for test cases if a test function isn't parameterized. #482

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

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jun 13, 2024

Internally, Swift Testing models non-parameterized test functions as parameterized over a single input, (). This is a very useful abstraction internally, but when it comes to the JSON output for parameterized tests, it can be confusing or surprising to see information about a test case that was synthesized by the library.

This PR suppresses events and metadata for the single test case of a non-parameterized test function.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…erized.

Internally, Swift Testing models non-parameterized test functions as
parameterized over a single input, `()`. This is a very useful abstraction
internally, but when it comes to the JSON output for parameterized tests, it can
be confusing or surprising to see information about a test case that was
synthesized by the library.

This PR suppresses events and metadata for the single test case of a
non-parameterized test function.
@grynspan grynspan added bug 🪲 Something isn't working tools integration 🛠️ Integration of swift-testing into tools/IDEs labels Jun 13, 2024
@grynspan grynspan self-assigned this Jun 13, 2024
@grynspan
Copy link
Contributor Author

@swift-ci please test

@briancroom
Copy link
Contributor

Have you thought about what kind/layering of test coverage we should have for this code?

@grynspan
Copy link
Contributor Author

Have you thought about what kind/layering of test coverage we should have for this code?

We already technically have tests that cover this code, it's just never been a failure for extra data to be present. I intend to add some additional test coverage once the JSON format is finalized per #479.

@grynspan grynspan merged commit 3f73ced into main Jun 14, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/no-test-case-events-in-json-stream-unless-parameterized branch June 14, 2024 02:11
plemarquand added a commit to plemarquand/vscode-swift that referenced this pull request Jun 14, 2024
swiftlang/swift-testing#482 removes the `_testCase`
field if the test isn't parameterized. The code that recorded issues
relied on this being present. If the issue for a parameterized test case
then just extract the test from the testID.
plemarquand added a commit to swiftlang/vscode-swift that referenced this pull request Jun 14, 2024
…#897)

swiftlang/swift-testing#482 removes the `_testCase`
field if the test isn't parameterized. The code that recorded issues
relied on this being present. If the issue for a parameterized test case
then just extract the test from the testID.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working tools integration 🛠️ Integration of swift-testing into tools/IDEs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants