Skip to content
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

Log the number of test cases run when a test function finishes #943

Open
mesqueeb opened this issue Feb 5, 2025 · 3 comments
Open

Log the number of test cases run when a test function finishes #943

mesqueeb opened this issue Feb 5, 2025 · 3 comments
Labels
command-line experience enhancements to the command line interface enhancement New feature or request good first issue Good for newcomers

Comments

@mesqueeb
Copy link

mesqueeb commented Feb 5, 2025

Description

Given test logs can easily get burried, the final test logs printed are significant to understand how well a test ran.

TLDR;

  • Currently: it's not clear from the final statement how many arguments were tested
  • Desired: I suggest below some extra logs to better understand the total arguments tested:

Expected behavior

Desired

􀟈 Test aPileBringsHuggers(moveFn:) started.
􀟈 Passing 1 argument moveFn → (Function) to aPileBringsHuggers(moveFn:)
// ...
​􁁛 Argument in aPileBringsHuggers(moveFn:) passed after 2 seconds. 🆕
​􀟈 Passing 1 argument moveFn → (Function) to aPileBringsHuggers(moveFn:)
// ...
​􁁛 Argument in aPileBringsHuggers(moveFn:) passed after 2 seconds. 🆕
​􁁛 Test aPileBringsHuggers(moveFn:) with 2 arguments passed after 4.677 seconds. 🆕

Here above, I suggested the lines marked as 🆕

  1. an extra log after each argument passes or fails, and
  2. a total amount of arguments tested to the final log.

Actual behavior

Currently (example with 2 arguments tested)

􀟈 Test aPileBringsHuggers(moveFn:) started.
􀟈 Passing 1 argument moveFn → (Function) to aPileBringsHuggers(moveFn:)
// ...
​􀟈 Passing 1 argument moveFn → (Function) to aPileBringsHuggers(moveFn:)
// ...
​􁁛 Test aPileBringsHuggers(moveFn:) passed after 4.677 seconds.

Given that these logs easily get buried, I think something like the above would be way better.

Steps to reproduce

Write a swift test with arguments and run it.

Relevant thread:
https://forums.swift.org/t/fr-test-with-arguments-and-closures-dx-suggestions-to-clarify-all-arguments-were-tested/77677/7

swift-testing version/commit hash

not sure how to check

Swift & OS version (output of swift --version && uname -a)

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Darwin Dendrocopus.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:02:41 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6030 arm64

@mesqueeb mesqueeb added the enhancement New feature or request label Feb 5, 2025
@mesqueeb mesqueeb changed the title [FR] Test with arguments and closures: DX suggestions to clarify all arguments were tested [FR] Test with arguments: DX suggestions to clarify all arguments were tested Feb 5, 2025
@grynspan
Copy link
Contributor

grynspan commented Feb 5, 2025

Argument in aPileBringsHuggers(moveFn:) passed after 2 seconds. 🆕

We intentionally do not include this line due to the noise it generates. We do indicate if an issue is recorded during executon of a test case.

Test aPileBringsHuggers(moveFn:) with 2 arguments passed after 4.677 seconds. 🆕

It should be possible for us to include the number of test cases run after a test function finishes.

@grynspan grynspan added good first issue Good for newcomers command-line experience enhancements to the command line interface labels Feb 5, 2025
@grynspan grynspan changed the title [FR] Test with arguments: DX suggestions to clarify all arguments were tested Log the number of test cases run when a test function finishes Feb 5, 2025
@briancroom
Copy link
Contributor

Argument in aPileBringsHuggers(moveFn:) passed after 2 seconds. 🆕

We intentionally do not include this line due to the noise it generates. We do indicate if an issue is recorded during executon of a test case.

We do have a verbosity control though - perhaps it could be useful to include this at some higher level?

@grynspan
Copy link
Contributor

grynspan commented Feb 6, 2025

We do have a verbosity control though - perhaps it could be useful to include this at some higher level?

Yes, sorry—I said that in my head but failed to type it out. :) We can add it in very-verbose mode. However, Xcode does not have a verbosity setting, so we should also file a radar to add such a thing in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command-line experience enhancements to the command line interface enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants