-
Notifications
You must be signed in to change notification settings - Fork 106
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
Assert.Fail() does not publish failed test #726
Comments
We'll need to repro this in the NUnit Console and determine if it is an NUnit issue, an adapter issue or a |
First pass, running this as a .NET 4.7.2 test in Visual Studio works fine, so it isn't NUnit or the NUnit Adapter. I'm also getting the same result with a .NET Core test assembly in Visual Studio.
and I am getting the same results using the TRX logger,
Clearly something is different in your setup. I am using .NET Core 3.1. What about you? How about the latest NUnit Adapter and Microsoft.NET.Test.Sdk, version 16.5.0? |
Microsoft.NET.Test.Sdk: 16.5.0 Did you check the contents of the .trx itself? I see: |
@MurrayLong, you are correct, I am seeing the same in the TRX file. This may be an NUnit Adapter issue, or it could be a VSTest issue. I will be moving this issue to the adapter. This is also being tracked in the VSTest repo at microsoft/vstest#2319 |
@OsirisTerje I've moved this here from NUnit as it is either an adapter issue or a VSTest issue. In the issue linked above in VSTest, they say that it works with 3.13 of the adapter. @MurrayLong mentioning you so that you have a quick link to the new location of your issue. |
@MurrayLong @rprouse I am not able to repro on neither 3.1.100 (TP 16.3) nor 3.1.200 (TP 16.5), please clarify which version of dotnet you are using by running # file global.json
{
"sdk": {
"version": "3.1.100"
}
} <!-- file nunit1.csproj -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>
</Project>
// file UnitTest1.cs
using NUnit.Framework;
namespace nunit1
{
[TestFixture]
public class ExampleTest
{
[Test]
public void This_test_should_fail()
{
Assert.Fail();
}
[Test]
public void This_test_should_pass()
{
Assert.Pass();
}
}
}
|
@nohwnd You have reproduced. compare trx: to dotnet test output:
|
Was an error on our side. Should be fixed here. |
@nohwnd Thanks! |
I did, is there a question? Or are you just copying the info so it's visible here as well? :) |
Just copied it here for visibility :-) |
I have a single test failing with Assert.Fail();
But no failures are listed in the trx output, as below.
Passing a message argument to Assert.Fail() fixes the problem.
test.cs:
The text was updated successfully, but these errors were encountered: