-
Notifications
You must be signed in to change notification settings - Fork 105
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:
![image](https://private-user-images.githubusercontent.com/3033827/247929923-79dad81e-dc9a-4282-941f-5fd7183d35a0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMjE4MzMsIm5iZiI6MTcyNjEyMTUzMywicGF0aCI6Ii8zMDMzODI3LzI0NzkyOTkyMy03OWRhZDgxZS1kYzlhLTQyODItOTQxZi01ZmQ3MTgzZDM1YTAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTJUMDYxMjEzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzZmMWE1YTUzMmQyMDBkYWE4ZGJiZWFhNTI0NzFkNzg0YzVjOGQ3Yjk5MGY3NDA1YWI4MzVmMWVmMzUwN2FiOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.MDsTyszrLXXYxuh6jlebCA5g3SpiXmk0jbJvAgaqu_w)
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: