如何输出使用 NUnit 3 运行的测试结果? [英] How can I output results of tests ran with NUnit 3?
问题描述
从昨天开始,我一直在想如何创建 NUnit3 可以生成的 XML 报告,但我找不到包含代码的单个示例.
Since yesterday I am trying to figure out how to create that XML report that NUnit3 can produce and I just can't find a single example with code.
我应该怎么做才能让 NUnit 3 生成结果文件,或者我应该在哪里寻找什么?
What should I do in order to make NUnit 3 produce the results file or what and where should I be looking for?
推荐答案
这绝对可以使用 nunit3-console.exe
来运行您的项目.
This can definitely be done using nunit3-console.exe
to run your project.
从 CMD/PowerShell 控制台,调用 \path\to\nunit3-console.exe \path\to\your.dll
.TestResult.xml
文件默认在 \myProjectFolder\bin\Debug
中创建.您还可以添加 -out=
标志来额外创建自定义日志.
From a CMD/PowerShell console, call \path\to\nunit3-console.exe \path\to\your.dll
. A TestResult.xml
file is created in \myProjectFolder\bin\Debug
by default. You can also add the -out=
flag to additionally create a custom log.
例如,\path\to\nunit3-console.exe \path\to\your.dll -out=\path\to\whereever\testResultFileName.xml
.对于一个简单的项目,有一个 [Test]
和一个 Console.WriteLine()
.testname 和 print 语句将显示在您的自定义文件中.
For instance, \path\to\nunit3-console.exe \path\to\your.dll -out=\path\to\whereever\testResultFileName.xml
. With a simple project, have a [Test]
and a Console.WriteLine()
. The testname and print statement will show up in your custom file.
这篇关于如何输出使用 NUnit 3 运行的测试结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!