Nunit 3.10堆栈跟踪信息不如3.9详细,如何恢复原输出级别?
Hey there! I totally get where you're coming from—when I upgraded NUnit to 3.10 a while back, I noticed the same truncation in stack traces and was frustrated at losing the detailed context from Selenium calls. The good news is you don't have to downgrade; there's a simple configuration tweak to get the full stack trace back.
Why this happens
NUnit 3.10 introduced default stack trace filtering to clean up output by hiding internal framework calls and focusing only on your test code. While this is helpful for simple failures, it's a pain when you need to debug deeper issues with tools like Selenium that rely on seeing the full call chain.
How to restore full stack trace output
Option 1: Use a configuration file
Add or modify your project's nunit.config (or app.config for .NET Framework projects) to disable stack trace filtering:
<configuration> <configSections> <sectionGroup name="NUnit"> <section name="TestRunner" type="NUnit.Framework.Configuration.TestRunnerSection, nunit.framework" /> </sectionGroup> </configSections> <NUnit> <TestRunner> <!-- Disable stack trace filtering to match NUnit 3.9 behavior --> <StackTrace DefaultProvider="NUnit" Filter="Off" /> </TestRunner> </NUnit> </configuration>
Save this file alongside your test assembly, and NUnit will now output the full, unfiltered stack trace just like in 3.9.0.
Option 2: Command-line argument (if using NUnit Console)
If you run tests via the NUnit Console runner, add the --stacktrace=full flag to your command:
nunit3-console.exe YourTestProject.dll --stacktrace=full
This overrides the default filtering for that run and outputs the complete stack trace.
Verification
After applying either setting, your stack trace should once again include all the intermediate calls from Selenium's wait methods, Page Objects proxies, and other library code—just like the 3.9.0 example you shared.
内容的提问来源于stack exchange,提问作者alex

