Skip to content

Diagnostics

“The suite is slow” is easier to fix with numbers. db-test can write one row per test to a tab-separated file.

Terminal window
DBTEST_TIMING=1 dotnet test

With DbTest.MSTest, this writes one row per test to dbtest-timing.tsv next to the test binaries.

It is off by default: no file is written unless it is switched on, and only the exact value 1 switches it on.

Set DBTEST_TIMING_FILE to write somewhere else:

Terminal window
DBTEST_TIMING=1 DBTEST_TIMING_FILE=timings.tsv dotnet test
Variable Effect
DBTEST_TIMING 1 turns timing on. Anything else leaves it off.
DBTEST_TIMING_FILE Overrides the output path. Default: dbtest-timing.tsv next to the test binaries.

The file is tab-separated, with the header kind, value, detail. Each test is one row:

  • kind is test;
  • value is the duration in milliseconds, with one decimal;
  • detail is the test name, ClassName.TestName.

The file is appended to, so several test assemblies can share one. The header is written only when the file is new or empty.

Diagnostics never fail a run. A write error is reported on the console and otherwise ignored.