-
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.Multiple doesn't provide stacktrace for found failures #1107
Comments
Thanks for reporting this @jochenwezel For your first point, I'm reminded of nunit/nunit#4242 . Do you feel like that one captures what you're looking for? For your second point, I suspect that it may actually be an adapter issue. |
Also, thank you for the clean repro and package version info. Can you also please confirm which version of Visual Studio you're using? |
The ticket of nunit/nunit#4242 describes an issue, that stack trace information is available for the multiple assertions, but with wrong line numbers.
Microsoft Visual Studio Community 2022 (64-Bit), v17.6 Please note for point 2 of my request: the stacktrace line numbers are clickable usually. My intention to write down point 2 is just for presenting a complete "feature request description" ;-) Maybe the code for point 2 is already there and active as soon as the stacktrace (re-)appears in point 1. |
The stacktrace is there, but there is something wrong either in the adapter code or in the way that the Test Explorer interprets the stacktrace. <assertion result='Failed'>
<message><![CDATA[ Expected: 4
But was: 42
]]></message>
<stack-trace><![CDATA[ at Issue4406.Tests.<>c__DisplayClass2_0.<Test1>b__0() in C:\repos\nunit\nunit.issues\Issue4406\UnitTest1.cs:line 29
at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at Issue4406.Tests.Test1() in C:\repos\nunit\nunit.issues\Issue4406\UnitTest1.cs:line 24
]]></stack-trace>
</assertion> This comes for each assert that fails, and contains the correct line numbers. <failure>
<message><![CDATA[Multiple failures or warnings in test:
1) Expected: 2
But was: 42
2) Expected: 3
But was: 42
3) Expected: 4
But was: 42
4) Expected: 55
But was: 5
]]></message>
<stack-trace><![CDATA[ at Issue4406.Tests.Test1() in C:\repos\nunit\nunit.issues\Issue4406\UnitTest1.cs:line 24
]]></stack-trace>
</failure> It can be that this is what is being sent to the Test Explorer. So this looks like an adapter bug, and I'll move it there. |
That is pretty interesting, because I don't ;-) Hmm.. until right now, I did get a stack trace too.... this is weird. But I think the reason for 3) is the way we send the stack trace and how Test Explorer expects it to be. I'll see if I can change them to be what I assume TE expects, a single stack trace line. |
There are at least 2 issues with the project in Issue4406:
|
@jochenwezel Sorry about being to quick pushing up there. Just set the version number to 4.5.0, I didn't do any code changes, so that should work. [Update] Just pushed up the changes, so just pull it down and it should work. |
Thanks! This is exactly the same as I see here. That's good. |
Current results
The current output for my test in Visual Studio is as following and is missing the stacktrace line for the indiviual failed assertion:
The same output is shown at
dotnet test
, except that stack trace lines are not clickableRequested results
Each asserition should
Current code snippets
Assert.Multiple is called as following:
PackageReferences are as following:
The text was updated successfully, but these errors were encountered: