Skip to content

Suppress "skipped tests" output in console-runner for Explicit or Ignore tests #431

@AGBrown

Description

@AGBrown

NUnit console: "nunit3-console.exe" v3.8.0

We use console-runner in a test script as part of git processes like git rebase --exec and git bisect. Often we'll have tests marked Explicit (they are slow tests, we don't need them for the git process, but we'll run them once we finished the process) or Ignore (we try and avoid this, but it happens if there is an issue open to fix it, but we can't get to it right now).

The issue is that the Tests Not Run output swamps the console (or the output log which is just the console output written to a file) when the script is run. All we really want to see on these test outputs is Green/Red (and if red then what went wrong). In this case the tests that were marked Explicit or Ignore are not important, and actually make it harder to go through the output log. The test summary also gives the total Skipped, Explicit and Ignore counts which is enough to note that there are tests that are not being run.

Things I tried:

  • Use --where=EXPRESSION to exclude tests marked Explicit or Ignore (doesn't work)
  • Use --noresult (doesn't work)
  • Use --trace=Error (doesn't work)

The only other workaround I could think of is to mark every Explicit or Ignore test also with a Category that can be excluded using --where, but we never remember to do this when it matters, and the ongoing argument has been that if we have already added one attribute that should be enough to remember to do.

TL;DR for the console runner is there a way to, or can we have a parameter that would, suppress the "Tests Not Run" output.


Sample test script:

(expand for full details).

#!/bin/sh
# exit on error
set -e

# ... do git stuff here to skip deliberately red commits in a red-green two-step ...

# ... do build scripts here ...

# Run unit tests
"C:\Program Files\NUnit\nunit3-console.exe" \
    //noresult \
    //stoponerror \
    ./src/A.Test.Project/A.Test.Project.csproj

status=$?
if [ $status -ne 0 ]
    then
        echo "Test failure, status $status."
        exit $status
fi

echo "Tests passed."

Repro steps:

  1. Have a test dll, mark a test as Explicit and another as Ignore
  2. Run the console runner using the shell script
  3. The output includes a "Tests not run" list with the Explicit and Ignore test listed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementV4All issues related to V4 or later - use -label:V4 to get V3 issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions