如何输出使用 NUnit 3 运行的测试结果?

编程入门 行业动态 更新时间:2024-10-25 20:22:26
本文介绍了如何输出使用 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 运行的测试结果?

本文发布于:2023-11-05 09:44:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560506.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   NUnit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!