我试图以编程方式检查我的单元测试是否作为我的部署过程的一部分传递。该应用程序使用MBunit和Gallio作为单元测试框架。如何以编程方式使用Gallio和MBUnit运行单元测试?
这里是我的代码:
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测试:
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? – jessehouwing
我正在VS2012 – Liath
我之前没有与Gallio一起工作过,所以我不确定这是否有问题,但您的'Tests'类不是'[TestFixture]'。也许Gallio没有看到“[Test]”,因为它找不到灯具。 – Caleb