-
Notifications
You must be signed in to change notification settings - Fork 152
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
Missing output with failed test stack traces for Assert.Multiple #1192
Comments
The Tests can create output by writing to the console or use of I'm closing this as not a bug, but in case you have added questions I'll still be able to see and answer your comments here. |
Hi @CharliePoole , but this is the major problem for us since we have a lot of output entries (200Mb+!) and we want to see in this output failing tests including stack traces. We do not use TestContext.Progress but we use log4net since all our productive code is using this globally. I keep searching for a way to add failing test information into output file else this doubles work effort for test failure analysis: must find failing test with stack trace in TFS build then find the exact same line in the output file which never contains any test failures and analyze order of events. How else we can automate writing test failures to the output file? Secondly, the problem which I face with multiple assert is that single stack trace shown to the test line but not including any internal failure stack traces which might be multiple ones too. Please check the Resharper output using Nunit tests and it provides all wanted information: image. Unfortunatelly, this is not fitting for our build servers but just for local debugging which is also in these case very complicated due scope of tests. Some test execution takes 5-10 minutes and hours to setup the environment to run. Thus this prevents us from using this feature and have to implement own handing which providing all internal stack trace information. Our complex and long tests have way much more levels in Assert.Multiple as result we cannot identify what exactly failed in the test without an internal stack trace in the Assert.Multiple. For us this is a clear bug since for such a case this is useless feature. |
I closed this because it talked about the So it is now sounding as if your issue isn't with the Can you show me what is in your TestResult.xml file versus what is displayed by the console? |
Thanks for clearing the idea, then still question for me how I can easily combine output file with test results (with stack traces) into single file? |
@gps7 When using the console app from the command line, you can redirect the output with NOTE: Use your own OS's command sequences if you aren't on windows. It's always a good idea say what OS you are using when posting an issue about an application, which runs under multiple operating systems.:-) With respect to the other runners (TestCentric GUI and NUnit3 VS Adapter), this is the console runner project. As explained in more depth in the comments I linked above, their code and functionality is different. They each receive all the same information from the framework but of course may display it differently. That's what runners do! My suggestion: make sure you are happy with this issue (the console) being closed and then see if you want to ask for new functionality from either of the other two runners, using their individual issue reporting. |
We are using Windows 2016-2019 servers to execute tests on Azure DevOps server agents. Adding >FILENAME, I believe this will result in no visible build results on DevOps pages and it would print information shown in build page. nunit3-console.exe My.Unittests.dll --test=My.TestClass --result=TEST_RESULT.xml;format=nunit2 --out=TEST_OUTPUT.log The console view is still showing all stack traces, but TEST_RESULT.xml file is not showing all stack traces. Eliminating the format requirement is quit problematic until we find a solution to resolve with coverage report for Azure DevOps. So question what could be the reason to have different output for older Nunit format? Here is part of result file with format=Nunit2:
]]> |
OK... a number of things here... You should experiment with redirection using the command-line as I suggested but also look at your Azure script to see if you can get the text output saved that way. (I'm not expert in Azure devops) WRT the NUnit2 format, It's definitely true that it is unable to support Assert.Multiple correctly, since the feature never existed under NUnit2. Tell your coverage provider to support the NUnit 3 format, which has been around for about 10 years now! However, I'm dubious that this is causing your problem because the internal format used by the framework and the console is still NUnit3. The information is there. You can prove this to yourself by adding a second Bottom line, if you can demonstrate that there is a real need for a way to redirect all output without turning off the console display, we can consider providing it. But you'll need to do the above experiments to show that. |
Yes, the result file has two kinds of error results provided. The The nunit3-console runner understands and uses the new format. When you run it directly from the command-line on your own machine or a server, it displays each error separately, with its own stack trace. If you had a case where running You suggest that the older format (in I can see that your server display uses the old format. Can you explain where that display comes from? |
@gps7 Sorry to ask, but are you reading all my answers? The change you are asking for would have to be made in the framework. I'm not a member of the framework team. I did also give you my opinion that they would not make such a change because it would be breaking for other people. That message is a legacy feature for backward compatibility and needs to stay as it is. Again, as already stated, TestCentric does not use the NUnit engine at all - it has its own. It's a separate project, which I created on my own and not as part of the NUnit organization. To a certain extent, it's a competing project with NUnit and any extended discussion should be done as an issue on the GUI at https://github.com/Testcentric/testcentric-gui. I will say this problem are probably due to the fact that the gui is unfinished. It's still in alpha release. I would definitely appreciate a bug report if you see one. Back to your problem... I'm confused because I use Azure DevOps to build the console runner and I don't see a display like yours anywhere. However, other folks set up the Azure build originally, so I may just be missing something. @mikkelbu @rprouse Can either of you help here? @gps7 what happens if you run the console through OpenCover on your desktop? |
Sorry @CharliePoole , I am reading emails but I have no idea on which github source Nunit framework and Adapter is located since did not checked the source code. I've already raised question on Nunit github and they offered to ask here. With regards TestCentric I know about it but was not sure if I should raise issue there since I noticed similar behavior in other products. So I will create a new ticket for that if it has own engine. |
Sorry for being a little testy, @gps7. I'm afraid that my leaving NUnit to do the GUI is a sore point for me and possibly others as well, so let's get into it on the TC project instead. Summarizing...
For all the projects under github.com/nunit, we can transfer an issue for you if it isn't in the right place. Sometimes, however, it isn't clear or multiple projects are involved, so separate issues work better. TC GUI issues have to go to the gui repo, with which you are already familiar. |
@CharliePoole thanks for detailed summary since was really hard to get how this part of Nunit works. I've created a new issue on TC, then same problem will be for vs-adapter. I believe the vs-adapter located here: https://github.com/nunit/nunit3-vs-adapter |
I've eliminated OpenCover from Azure DevOps build and result is still same. Here is the executed command line this time:
And test overview is still same: I have no explanation on this and no ideas anymore what else I can try it out to determine the source of this test results. |
OK. I'll try to duplicate this myself. |
I'm pretty convinced that Azure is actually the cause of the problem. I believe it reads the TestCentric.xml file and only looks at the legacy failure element. In addition to the problem with I'm closing this again and I'll see about filing an issue with the Azure team. |
@gps7 If there were an option in the console like I can't promise fast action, but if it makes sense and you file an issue, I'll put it on the backlog for version 4. |
@CharliePoole thanks for analysis and great support. Offered feature would be a great benefit for us to have output of all information combined and this would help to have one source instead multiple sources. Additionally, start of test as well as test results with count of failed and successful tests would be a great advantage for us. I was planning to create a new feature request for the next week. |
Hi,
I am missing test output with stack traces for failed tests. For running example test fails but output not showing any information about failures nor even mention that test has failed:
[Test]
public void AssertMultiple()
{
Assert.Multiple(() =>
{
ValidateInteger();
Assert.That("a", Is.EqualTo("b"), "String");
ValidateInteger();
});
}
private void ValidateInteger() => Assert.That(1, Is.EqualTo(2), "Integer");
Running Nunit console with fallowing command line provides empty TEST_OUTPUT.log file:
"nunit3-console.exe" MyTests.dll --test=MyTests.TestClass.AssertMultiple --out=TEST_OUTPUT.log
I've tried to run v3.15.0. I assume this also affects the Test Centric since it shows failing test but output is always empty. I've expect to see not only failures but also 3 stack traces for 3 failures.
List of affected applications:
I am using Framework 4.8.
This is a fallow up issue after creating issue #4129 at Nunit. Please refer to this item for more details if needed.
The text was updated successfully, but these errors were encountered: