10

i have problem with xunit, its skipping all tests without any message or error, i'm using ubuntu 20.04 but on windows 10 i have the same problem

michael@michael-System-Product-Name:~/gradebook$ cd test
michael@michael-System-Product-Name:~/gradebook/test$ mkdir GradeBook.Test
michael@michael-System-Product-Name:~/gradebook/test$ cd GradeBook.Test
michael@michael-System-Product-Name:~/gradebook/test/GradeBook.Test$ sudo dotnet new xunit
[sudo] password for michael: 
Getting ready...
The template "xUnit Test Project" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/michael/gradebook/test/GradeBook.Test/GradeBook.Test.csproj...
  Determining projects to restore...
  Restored /home/michael/gradebook/test/GradeBook.Test/GradeBook.Test.csproj (in 548 ms).
Restore succeeded.

michael@michael-System-Product-Name:~/gradebook/test/GradeBook.Test$ sudo dotnet test
  Determining projects to restore...
  All projects are up-to-date for restore.
  GradeBook.Test -> /home/michael/gradebook/test/GradeBook.Test/bin/Debug/net5.0/GradeBook.Test.dll
Test run for /home/michael/gradebook/test/GradeBook.Test/bin/Debug/net5.0/GradeBook.Test.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 1 ms - /home/michael/gradebook/test/GradeBook.Test/bin/Debug/net5.0/GradeBook.Test.dll (net5.0)
8
  • 1
    That didn't skip any - it ran 1 test, which passed. (I question why you're using sudo to run dotnet new though.)
    – Jon Skeet
    Jan 28, 2021 at 16:52
  • @jonskeet anything that ive wrote in this test pass(skips) , even when condition are impossible to met, like 3 equals 5, im using sudo because nothing worked so far :(
    – Michal G
    Jan 28, 2021 at 16:56
  • "Passes" and "skips" are not the same thing at all. Your output clearly shows that no tests are being skipped, and one test is passing - which is what I'd expect given that you've just created a new test project. You haven't shown a failing test, or indeed any sign of editing the tests at all. Please put some time into clarifying your question.
    – Jon Skeet
    Jan 28, 2021 at 17:05
  • @jonskeet oh... i was too hurry to post this thread, youre right, sorry for trouble, i've lots of problem with junit and thought this will be the same
    – Michal G
    Jan 28, 2021 at 17:12
  • 2
    As simple as it is, I made exactly the same reading comprehension error. Luckily this was was the first google hit for "xunit skipping all tests". Thanks all. Jun 3, 2021 at 2:41

1 Answer 1

43

Been there, done that. It's just an optical illusion :)

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, ...

Try to read that line again. It says Passed! And the passed number of tests were 1. The skipped number of tests were actually 0. It's just that our eyes read what's close together.

4
  • 5
    This is horrible, lol Feb 22, 2022 at 22:58
  • 1
    UGH I fell for it...
    – Nomnom
    Jun 30, 2022 at 6:02
  • 1
    I feel like we need a counter on here. I fell in this hole too :D Oct 7, 2022 at 13:35
  • 1
    i hate my life; Nov 8, 2022 at 12:48

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.