Visual Studio 2008 和 2010 的 Gallio 测试运行器插件用于 MBUnit 测试

发布于 2024-08-28 23:54:23 字数 128 浏览 1 评论 0原文

如果我安装 Gallio 3.x,它还会安装 Visual Studio 的测试运行器插件吗?

或者我必须使用 TestDriven.NET 或 Visual Nunit 等附加插件才能从 VS 中运行 MbUnit 测试类?

If I install Gallio 3.x will it also install a test runner plugin for Visual Studio?

Or must I use an additional plug-in like TestDriven.NET or Visual Nunit to run MbUnit test classes from within VS?

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

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

发布评论

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

评论(3

黯然 2024-09-04 23:54:23

在开发机器上安装 Gallio 3.1。然后在 VS2008 中,您可以选择创建“MbUnit v3 测试项目”。这不仅仅包括所有的 Gallio dll,它在项目中还有一条魔线,将 VS 识别为测试项目。

您现在可以使用内置的 VS2008 测试运行程序。

如果您有任何包含单元测试的现有项目,而不是创建新项目,请编辑现有项目文件并在第 9 行添加以下行(在第 8 行的 下方)

 <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

:(如果您有 VB 项目,则它具有不同的第二个 GUID:{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}< /code> 您可以通过从随 Gallio 安装的模板创建一个新的 MbUnit 测试项目,然后在文本编辑器中查看项目文件(.csproj 或 .vbproj)来找到正确的值。)

现在,当您重新加载项目时,VS2008会将其识别为测试项目。

我发现与使用 Icarus 相比的一个明显优势是,调试现在更加直接,可以按预期命中断点。

祝你好运,李

Install Gallio 3.1 on the dev machine. Then in VS2008, you'll have the option to create a "MbUnit v3 Test Project". This doesn't just include all of the Gallio dlls for you, it has a magic line in the project which identifies it to VS as a Test project.

You can now just use the in-built VS2008 Test runner.

If you have any existing projects with unit tests in, rather than making new projets, edit your existing project file and add the following line on line 9 (underneath the <ProjectGuid> on line 8):

 <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

(If you have a VB project, it has a different second GUID: <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids> You can find the correct values by creating a new MbUnit test project from the templates installed with Gallio and then looking at the project file (.csproj or .vbproj) in a text editor.)

Now when you reload the project, VS2008 will recognise it as a test project.

A distinct advantage that I found over using Icarus was that debugging is now far more straight forward with break points being hit as expected.

Good Luck, Lee

逆光下的微笑 2024-09-04 23:54:23

TestDriven.Net 运行得非常好。 Gallio 还支持 ReSharper 单元测试运行器和 Visual Studio 测试工具。我们将于本周发布新版本的 Gallio,支持 R# 5.0 和 VS 2010。

TestDriven.Net works really well. Gallio also supports the ReSharper unit test runner and Visual Studio test tools. We will be shipping a new release of Gallio this week with support for R# 5.0 and VS 2010.

澜川若宁 2024-09-04 23:54:23

这些是使用简洁的 NUnit 技巧在 Visual Studio 2012 及更高版本中运行 MBUnit 测试的说明。

首先,安装 NUnit Test Adapter 扩展(是的,NUnit)

  • Tools >扩展和更新>在线>>搜索 NUnit >安装
    NUnit 测试适配器。
  • 您可能需要重新启动 Visual Studio IDE。

然后,您只需将新的 NUnit 测试属性添加到您的测试方法中即可。请参阅此处的示例代码(注意顶部的 using 语句)...

//C# example
using MbUnit.Framework;
using NuTest = NUnit.Framework.TestAttribute;

namespace MyTests
{
    [TestFixture]
    public class UnitTest1
    {
        [Test, NuTest]
        public void myTest()
        {
            //this will pass
        }
    }
}

您可以在 Visual Studio 中运行和调试测试,因为 NUnit 和 Gallio Icarus GUI 测试运行程序将作为 MBUnit 运行它们(例如启用并行运行)。您需要通过删除 Gallio 安装位置中的 NUnit 文件夹来阻止 Gallio 运行 NUnit 测试,即 C:\Program Files\Gallio\bin\NUnit

希望这会有所帮助,这是一个简单的工作方法,所以请投票,非常感谢。

These are instruction for running MBUnit tests in Visual Studio 2012 and above using a neat NUnit trick.

Firstly, install the NUnit Test Adapter extension (yes, NUnit)

  • Tools > Extension and Updates > Online > search for NUnit > install
    NUnit Test Adapter.
  • You may need to restart the Visual Studio IDE.

Then, you simply need to add a new NUnit test attribute to your test methods. See example code here (notice the using statements at the top) ...

//C# example
using MbUnit.Framework;
using NuTest = NUnit.Framework.TestAttribute;

namespace MyTests
{
    [TestFixture]
    public class UnitTest1
    {
        [Test, NuTest]
        public void myTest()
        {
            //this will pass
        }
    }
}

You can run and debug the test in visual studio as NUnit and Gallio Icarus GUI Test Runner will run them as MBUnit (enabling parallel runs for example). You will need to stop Gallio from running the NUnit tests by deleting the NUnit folder in the gallio install location i.e. C:\Program Files\Gallio\bin\NUnit

Hope this helps, this is a simple working method so please vote up, many thanks.

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