【发布时间】:2014-01-29 10:04:49
【问题描述】:
我正在尝试以编程方式检查我的单元测试是否作为部署过程的一部分通过。该应用程序使用 MBunit 和 Gallio 作为其单元测试框架。
这是我的代码:
var setup = new Gallio.Runtime.RuntimeSetup();
setup.AddPluginDirectory(@"C:\Program Files\Gallio\bin");
using (TextWriter tw = new StreamWriter(logFilename))
{
var logger = new Gallio.Runtime.Logging.TextLogger(tw);
RuntimeBootstrap.Initialize(setup, logger);
TestLauncher launcher = new TestLauncher();
launcher.AddFilePattern(dllToRunFilename);
TestLauncherResult result = launcher.Run();
}
这是我正在加载的 DLL 中包含的测试(我已经验证了它可以与 Icarus 测试运行程序一起使用):
public class Tests
{
[Test]
public void Pass()
{
Assert.IsTrue(true);
}
[Test]
public void Fail()
{
Assert.Fail();
}
}
当我运行应用程序时,我在results 中得到以下值
这是不正确的,因为确实有要运行的测试!日志文件中包含以下内容
禁用插件“Gallio.VisualStudio.Shell90”:插件启用 条件不满足。请注意,这是预期的 必须托管在第三方内部的插件的行为 应用程序才能工作。启用条件: '${process:DEVENV.EXE_V9.0} 或 ${process:VSTESTHOST.EXE_V9.0} 或 ${process:MSTEST.EXE_V9.0} 或 ${framework:NET35}'。禁用插件 'Gallio.VisualStudio.Tip90':插件依赖于另一个禁用 插件:'Gallio.VisualStudio.Shell90'。
如何解决此问题并找到测试结果?
【问题讨论】:
-
什么版本的 Visual Studio?
-
我在VS2012工作
-
我之前没有与 Gallio 合作过,所以我不确定这是否重要,但您的
Tests课程不是[TestFixture]。也许 Gallio 没有看到[Test]的读数,因为它找不到固定装置。 -
@Caleb 我已经删除了 TestFixture 属性,它没有任何区别。我还通过 Icarus 测试运行程序确认了 DLL - 它的行为符合预期。
标签: c# unit-testing visual-studio-2012 mbunit gallio