Skip to content

Test duration is added instead of being updated (every second) #6753

@HakamFostok

Description

@HakamFostok

Hello all.
Here is the original bug that I opened in TUnit
thomhurst/TUnit#3395
And they redirected me to here.


Disclaimer: I am using TUnit.Playwright package, but with TUnit package alone, this behavior does not exist; it is a possibility that this behavior is caused by Playwright, not TUnit

First of all, thanks for resolving the #3187 issue. I confirm it is solved.
Now, when I run the test like this dotnet run --log-level Warning, I only have the log with Warning and above levels.

But something caught my eye

For every passing second, there are 2 logs.
This is making the log much longer than needed, and prevents the user from focusing on the important information
below is a trimmed example; the real log is much, much longer.
I have some playwright test that runs for 3 minutes, they generate about (3 * 60 * 2 = 3600) logs

████████╗██╗   ██╗███╗   ██╗██╗████████╗
╚══██╔══╝██║   ██║████╗  ██║██║╚══██╔══╝
   ██║   ██║   ██║██╔██╗ ██║██║   ██║
   ██║   ██║   ██║██║╚██╗██║██║   ██║
   ██║   ╚██████╔╝██║ ╚████║██║   ██║
   ╚═╝    ╚═════╝ ╚═╝  ╚═══╝╚═╝   ╚═╝

   TUnit v0.71.4.0 | 64-bit | Microsoft Windows 10.0.26100 | win-x64 | .NET 9.0.10 | Microsoft Testing Platform v2.0.1

   Engine Mode: SourceGenerated

[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
0s)
[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
1s)
[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
1s)
[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
2s)
[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
2s)
[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
3s)
[✓0/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
3s)


.
.
.
.
.
.
.
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
33s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
33s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
34s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
34s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
35s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
35s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
36s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
36s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
37s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
37s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (
38s)
[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (38s)
  Create with all values for ad                                                                                                                                                                          (10s)

I suggest that at the end of the test, one long is generated with the time that has passed
Here is an example

████████╗██╗   ██╗███╗   ██╗██╗████████╗
╚══██╔══╝██║   ██║████╗  ██║██║╚══██╔══╝
   ██║   ██║   ██║██╔██╗ ██║██║   ██║
   ██║   ██║   ██║██║╚██╗██║██║   ██║
   ██║   ╚██████╔╝██║ ╚████║██║   ██║
   ╚═╝    ╚═════╝ ╚═╝  ╚═══╝╚═╝   ╚═╝

   TUnit v0.71.4.0 | 64-bit | Microsoft Windows 10.0.26100 | win-x64 | .NET 9.0.10 | Microsoft Testing Platform v2.0.1

   Engine Mode: SourceGenerated

[✓2/x0/↓1] Troy.WebApp.UITests.dll (net9.0|x64)                                                                                                                                                          (38s)
  Create with all values for ad

In this case, the log shows how long a test took, but it does not log every second of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions