以编程方式调用mbunit测试运行器

本文关键字:测试运行 mbunit 调用 编程 方式 | 更新日期: 2023-09-27 18:06:00

我目前正在使用mbunit构建一个测试套件。到目前为止一切顺利,但是我不想使用附带的Icarus GUI,而是想拥有自己的测试运行器。不知道该怎么做,我去了Gallio的Google组,复制了一个用户发布的代码:

http://groups.google.com/group/gallio-user/browse_thread/thread/afab404a14674cd2

我得到了下面的异常:

Gallio.Runtime。未处理RuntimeException消息=无法解析服务类型"Gallio.Runner.Projects"的组件。因为似乎没有为该服务类型注册和启用的任何组件。源=不负责任的人加:在Gallio.Runtime.Extensibility.RegistryServiceLocator。ResolveNonDisabledDescriptor (serviceType型)在Gallio.Runtime.Extensibility.RegistryServiceLocator。ResolveImpl (serviceType型)在Gallio.Runtime.Extensibility.RegistryServiceLocator.ResolveTService在Gallio.Runner.TestLauncher.RunWithRuntime ()在Gallio.Runner.TestLauncher.Run ()在C:'Users'edmondc'Documents'Visual Studio 2010'Projects'AutomatedTestSystem'TestPrograms'ImageComparisonTest'Driver.cs:第49行在Dundas.Dashboard.TestSystem.Program。Main(String[] args) in C:'Users'edmondc'Documents'Visual Studio 2010'Projects'AutomatedTestSystem'TestConsole'Program.cs:第13行在System.AppDomain。_nExecuteAssembly(运行时汇编程序集,字符串[]args)在System.AppDomain。ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly ()在System.Threading.ThreadHelper。ThreadStart_Context(对象状态)在System.Threading.ExecutionContext。运行(ExecutionContext ExecutionContext, ContextCallback, callback, Object state, Boolean ignoreSyncCtx)在System.Threading.ExecutionContext。运行(ExecutionContext, ExecutionContext, ContextCallback, callback, Object state)在System.Threading.ThreadHelper.ThreadStart ()InnerException:

我哪里做错了?

以编程方式调用mbunit测试运行器

您可能想要使用可能在Gallio安装目录中找到的Gallio Loader。加载器以两个c#源文件的形式提供,您需要将其包含在项目中。它的目的是简化自定义应用程序中Gallio的集成。

一个简单的用法如下:

TestLauncher launcher = new TestLauncher();
launcher.AddFilePattern("MyTestAssembly.dll");
TestLauncherResult result = launcher.Run();

EDIT:要了解测试启动器的更复杂用法,请查看Echo源代码。