fluffynuts / quackers

A console logger for dotnet test with super-duck-powers!
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Quackers - a cute, noisy console logger for dotnet test

A duck quacking loudly

[ image credits: https://www.instagram.com/adrawingattempt ]

Why?

The standard console logger doesn't summarise errors after a test run. If you have several thousand tests, you'll have to scroll back up through them to get to the source of problems ):

Quackers outputs errors again at the end of the test. It also outputs fully-qualified test names, not just the name of the test method, so you can better tell what's going on from looking at the logs.

Usage

  1. install Quackers.TestLogger into your test project(s)
  2. invoke dotnet test {project} -l quackers
  3. configure either
    • via logger properties (eg dotnet test -l "quackers:passlabel=ok;faillabel=fail")
      • passlabel :: string
      • faillabel :: string
      • nonelabel :: string
      • skiplabel :: string
      • notfoundlabel :: string
      • nocolor :: boolean
      • theme :: string ("default" or "darker" - depending on where you want to run tests, a darker theme may be more comfortable)
      • highlight_slow_tests :: boolean
      • slow_test_threshold_ms :: integer
      • debug_log_file :: string (path)
      • show_timestamps :: boolean
      • verbose_summary :: boolean
      • output_failures_inline :: boolean
      • show_help :: boolean
      • summary_start_marker :: string
      • summary_complete_marker :: string
      • failure_start_marker :: string
      • slow_summary_start_marker :: string
      • slow_summary_complete_marker :: string
      • log_prefix :: string
      • test_name_prefix :: string
      • failure_index_placeholder :: string
      • slow_index_placeholder :: string
    • or by environment variables, all the above values, but prefixed with QUACKERS_, eg
      • QUACKERS_PASSLABEL
      • QUACKERS_FAILLABEL
      • QUACKERS_NONELABEL
      • QUACKERS_SKIPLABEL
      • QUACKERS_NOTFOUNDLABEL
      • QUACKERS_NOCOLOR
      • ... etc

Configuration options

This means that the following are equivalent:

QUACKERS_SHOW_VERBOSE_SUMMARY=1 dotnet test Tests.csproj --logger quackers
QUACKERS_showverbosesummary=true dotnet test Tests.csproj --logger quackers
dotnet test Tests.csproj --logger 'quackers;verboseSummary=yes'

During testing, I've found some ocassions where the test host doesn't pass through all the configuration parameters I've specified on the line (perhaps due to some strange shell quoting issue). If you find that quackers is not obeying your configuration, try setting the appropriate environment variables instead.

What do the config parameters do?

Styling the output:

Controlling what is output:

Markings to make the output easier to consume and collate

Since the inbuilt console logger that comes with the dotnet test host apparently can't be completely disabled, and since running tests in parallel is no longer supported via easy commandline, my own orchestration in zarro injects some markers to make it easier to ingest the outputs:

Credits

Quackers.TestLogger uses the Pastel console coloring library to look pretty. Pastel is inlined via a submodule at the time of building Quackers.