Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HIGH IMPORTANCE] dotnet test should return a non-0 exit code when any tests fail #241

Closed
TheRealPiotrP opened this issue Nov 23, 2016 · 7 comments
Assignees

Comments

@TheRealPiotrP
Copy link
Contributor

This is important and we'd really appreciate a quick fix.

Repro:

  [Fact]
  public void AlwaysFail()
  {
       throw new Exception("Not a winner...");
  }

dotnet test

$? on OS X, similar 'get last exit code' elsewhere

Expected:
non-0 exit code returned, indicating test failure

Actual:
0 returned, indicating success.

Impact:
CLI Builds cannot be trusted right now. There is no way to detect test failure during build execution on local dev box nor in CI. @MattGertz this is likely associated with the NuGet PR @livarcocc is backing out right now.

@blackdwarf I know you're looking at UX in this space, so FYI.

dotnet --info:

.NET Command Line Tools (1.0.0-preview4-004114)

Product Information:
 Version:            1.0.0-preview4-004114
 Commit SHA-1 hash:  04c5d39c03

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.11-x64
 Base Path:   /Users/piotrp/code/github/piotrpMSFT/cli/artifacts/osx.10.11-x64/stage2/sdk/1.0.0-preview4-004114
@TheRealPiotrP
Copy link
Contributor Author

Additional repro info: I am using zsh as my console. Will see if this repros out of plain terminal

@TheRealPiotrP
Copy link
Contributor Author

ACK on terminal repro. Also attaching a proper repro zip.
microsoft.vstest.issue.241.repro.zip

@codito
Copy link
Contributor

codito commented Nov 23, 2016

It looks like vstest.console is returning non-zero on test failure and vstest task is always returning true.

Will confirm shortly.

@sbaid
Copy link
Contributor

sbaid commented Nov 23, 2016

@Faizan2304

@Faizan2304 Faizan2304 self-assigned this Nov 23, 2016
Faizan2304 added a commit that referenced this issue Nov 23, 2016
@codito
Copy link
Contributor

codito commented Nov 23, 2016

Fixed with 592a213

@codito codito closed this as completed Nov 23, 2016
@TheRealPiotrP
Copy link
Contributor Author

Wonderful! Thanks!

What build # should we pick up?

@Faizan2304
Copy link
Contributor

Fix is in this PR dotnet/cli#4810

TheRealPiotrP pushed a commit to dotnet/cli that referenced this issue Nov 24, 2016
* Bug fixes

* Nitpick

* -Fixed failed tests
-Added test to cover trx logger scenario.

* Fix for issue microsoft/vstest#241

* Fix for failed test. We have taken fix where dotnet test will return nonzero if test fails. In multi TFM scenario if test fails it termates the whole process as dotnet test is returning 1. As a fix of this we should continue if some test fails for next TFM

* Bump Microsoft.Testplatform.CLI and Microsoft.NET.Test.Sdk version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants