我创建了 NUnit 测试,现在如何运行它们?

发布于 2024-07-22 02:17:33 字数 355 浏览 5 评论 0原文

我正在使用 vs2008、c#、.net 3.5 进行开发。

我下载了NUnit 2.5 win/msi版本。 我创建了一个包含多个 [Test] 方法的 [TestFixture] 类。

我如何运行测试?

当我运行 Ed Ames 的 NUnit 演示解决方案时,他的测试 .cs 文件在代码左侧的灰色栏中有一个图标(与断点、书签等显示的位置相同。)单击该图标会给我一个选项运行测试。

该图标没有出现在我的项目中。 是否有我需要设置的属性?

此外,文档还提到了可用于运行测试的 NUnit GUI。 NUnit 的 msi 版本中似乎没有下载 GUI。 Gui 有单独的下载吗?

I'm developing in vs2008, c#, .net 3.5.

I downloaded NUnit 2.5 win / msi version. I have created a [TestFixture] Class containing several [Test] methods.

How do I run the tests?

When I run a NUnit demo solution from Ed Ames, his test .cs files have an icon in the grey column to the left of the code (same place where breakpoints, bookmarks, etc show up.) Clicking on the icon gives me an option to run the tests.

That icon is not showing up in my projects. Is there a property I need to set?

Also, the documentation refers to a NUnit GUI that can be used to run the tests. A GUI doesnt seem to have downloaded in the msi version of NUnit. Is there a separate download for the Gui?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

梦途 2024-07-29 02:17:33

感谢你们所有的帮助。

我正在使用 resharper,忘了提及它。

实际上,测试没有运行(在文件中找不到测试),因为我的 [TestFixture] 类不是公共的。 将其更改为公开,我所有的测试都显示出来了。

另外,感谢您帮助找到 Gui。 我正在寻找文件名中带有 GUI 的 exe。 但我将使用 Resharper 来运行测试。 现在我已经找到他们了!

Thanks for all your help guys.

I am using resharper, forgot to mention it.

Actually, tests were not running (no tests found in file) because my [TestFixture] class was not Public. Changed it to Public and all my tests showed up.

Also, thanks for your help finding the Gui. I was looking for an exe with GUI in the filename. But I will use Resharper to run the tests. Now that I have found them!

梦里南柯 2024-07-29 02:17:33

您看到的演示很可能有一个 VS 插件(Resharper、TestDriven.NET 等),但 NUnit 并未附带该插件。 但是,NUnit 使用 GUI 进行安装。 转到您安装 NUnit 的文件夹,您将在那里找到它。

该程序名为 nunit.exe,位于 bin 文件夹中。

启动后,您需要转到“文件”->“ 打开Project并找到您在Visual Studio中构建的DLL

The demo you saw most likely had a VS plug in (Resharper, TestDriven.NET, etc.), which doesn't come with NUnit. However, NUnit installs with a GUI. Go to the folder that you installed NUnit and you will find it there.

The program is called nunit.exe and it's in the bin folder.

Once you start it, you'll need to go to File -> Open Project and find the DLL you built in Visual Studio

朱染 2024-07-29 02:17:33

我相信您可以使用 nUnit 附带的 nUnit 运行程序(GUI - bin 文件夹中的 nunit.exe,控制台 - nunit-console-x86.exe)。

或者,如果您安装了 resharper (http://www.jetbrains.com/resharper/) ,它有一个测试运行程序。

还有 TestDriven.Net (http://www.testdriven.net/)

You can use the nUnit runner (GUI - nunit.exe in the bin folder, Console - nunit-console-x86.exe) which comes with nUnit I believe.

Alternatively, if you have resharper (http://www.jetbrains.com/resharper/) installed, it has a test runner.

There is also TestDriven.Net (http://www.testdriven.net/)

一身骄傲 2024-07-29 02:17:33

我还没有看过这个演示,但听起来很像他正在使用 Resharper

如果您运行 msi 安装程序,它将安装 NUnit GUI 运行程序。 如果您浏览开始菜单,它可能位于“程序”->“程序”下。 努尼特。 从 GUI 运行程序中,您可以导航到项目的 bin 目录来加载测试程序集。

I haven't seen this demo, but it sounds very much like he is using Resharper.

If you ran the msi installer, it will have installed the NUnit GUI runner. If you browse your start menu its likely under Programs -> Nunit. From the GUI runner you can load your test assembly by navigating to the bin directory of your project.

满天都是小星星 2024-07-29 02:17:33

您必须使用 1) Nunit 命令行或 2) Nunit GUI 打开 dll

You have to open the dll with 1) Nunit command line or 2) Nunit GUI

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文