Skip to content

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

@mesqueeb

Description

@mesqueeb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions