【问题标题】:MSpec runs under ReSharper fine, but TD.NET throws exceptionMSpec 在 ReSharper 下运行良好,但 TD.NET 抛出异常
【发布时间】:2011-01-25 22:06:15
【问题描述】:

我在尝试使用 TD.NET 运行 mspec 规范测试时收到此异常。

------ Test started: Assembly: DesignRightWeb.Specs.dll ------

Error: Runner failure: System.Runtime.Serialization.SerializationException: Type is not         resolved for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications,     Version=0.3.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at     Machine.Specifications.Runner.Impl.AppDomainRunner.CreateRunnerAndUnloadAppDomain(String     runMethod, AppDomain appDomain, Assembly assembly, Object[] args) in d:\BuildAgent-    01\work\340c36596c29db8\Source\Machine.Specifications\Runner\Impl\AppDomainRunner.cs:line     81
Test 'T:DesignRightWeb.Specs.given_a_string_calculator' failed: Type is not resolved     for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications,     Version=0.3.0.0, Culture=neutral, PublicKeyToken=null'.
    System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null'.
    at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
    at Machine.Specifications.Runner.Impl.AppDomainRunner.CreateRunnerAndUnloadAppDomain(String runMethod, AppDomain appDomain, Assembly assembly, Object[] args)
    at Machine.Specifications.Runner.Impl.AppDomainRunner.RunMember(Assembly assembly, MemberInfo member)
    at Machine.Specifications.TDNetRunner.SpecificationRunner.RunMember(ITestListener testListener, Assembly assembly, MemberInfo member)
    at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
    at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()

0 passed, 1 failed, 0 skipped, took 1.12 seconds (MSpec).

我尝试直接从 Github 安装 MSpec,也使用 NuGet 安装它。之后 - 在收到同样的异常时 - 我卸载了 TD.NET 并重新安装了 TD.NET。仍然收到此异常。

有什么想法吗?想法?解决方案?

【问题讨论】:

    标签: unit-testing resharper bdd testdriven.net mspec


    【解决方案1】:

    您是否需要将 MSpec 测试运行程序注册到 TestDriven.NET?查看这篇文章以帮助您:

    http://eduncan911.com/blog/registering-mspec-runners-for-testdriven-net-on-windows-x64.aspx

    【讨论】:

    • 使用TD.Net >= 2.24就不需要注册跑者了。只需将 Machine.Specifications.dll.tdnetMachine.Specifications.TDNetRunner.dll 放在项目引用的 Machine.Specifications.dll 旁边即可。
    【解决方案2】:

    如果您之前注册过 TD.Net 运行器,请取消注册(可能需要对注册表进行一些黑客攻击 - 请参阅 InstallTDNetRunner.bat 如何撤消)。

    请确保您运行 TD.Net >= 2.24。将 NuGet 包添加到您的项目并通过 TD.Net 运行测试。 NuGet 包还包含您可能想要安装的更新的 ReSharper 运行程序。

    如果错误仍然存​​在,您很可能在某处引用了旧版本的 MSpec。旧版本是 0.3.0.0,而 NuGet 当前是 0.4.7.0。

    (我可能会添加 - 当您发布您的问题时,我们已经有一个 NuGet 包由某人提供。该包不包含适当的 TD.Net 运行器。您描述的问题现在应该得到解决,因为我们有一个新的包含所有跑步者的 NuGet 包。)

    【讨论】:

      猜你喜欢
      • 2012-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-25
      • 1970-01-01
      相关资源
      最近更新 更多