最近我在TeamCity构建中运行MSpec测试时遇到了问题。这发生在两个不同的(不相关的)项目上。一切都可以在本地运行,但是当TeamCity构建运行时,我会得到一些MSpec类型的MissingMethodExceptions。
然后构建继续运行我的规范的所有5个(到目前为止),所有传递。虽然构建失败,因为该步骤完成时出现错误。
如果它有任何区别,我的目标是使用.NET 4.5并使用mspec-clr4.exe
在TeamCity服务器上运行测试。我使用MSpec 0.5.9并使用TeamCity的NuGet安装程序直接从NuGet中获取它。我们在TeamCity 7.1上
这是我的构建步骤配置
这是日志文件输出的一部分:
[04:27:12]Step 3/4: Unit test and Code Coverage (MSpec) (47s) [04:27:12]Starting: C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit [04:27:12]in directory: C:\BuildAgent\work\13af8c5b6a6273c6 [04:27:22]JetBrains dotCover Console Runner v2.0.425.72. Copyright (c) 2009-2012 JetBrains s.r.o. All rights reserved. [04:27:22] [04:27:39][JetBrains dotCover] Coverage session started [15/10/2012 04:25:58] [04:27:45]Running specifications. [04:27:47] System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap) at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly) at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options) [04:27:48] System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap) at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly) at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options) [04:27:48] System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap) at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly) at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options) [04:27:48] System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap) at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly) at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options) [04:27:48] System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap) at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly) at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options) [04:27:48] System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap) at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly) at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options) [04:27:48]Running specifications in Tigra.Graffiti.Specifications [04:27:48]Tigra.Graffiti.Specifications (2s) [04:27:50]CalendarFunctions CSS based formatting, when building calendar day listitem > should produce expected html [04:27:50]CalendarFunctions CSS based formatting, when building calendar day listitem for event day > should produce html with event date css class [04:27:51]CalendarFunctions CSS based formatting, when building calendar day listitem for day with events > should produce html with hasEvents css class [04:27:51]CalendarFunctions CSS based formatting, when building calendar day listitem for day with events and is event date > should produce html with event date css class [04:27:51]CalendarFunctions CSS based formatting, when building calendar day listitem for day with events and events are included > should produce html with event date css class [04:27:51]Runner failure: System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications, Version=0.5.9.0, Culture=neutral, PublicKeyToken=null'. [04:27:51] at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) [04:27:51] at Machine.Specifications.Runner.Impl.AppDomainRunner.CreateRunnerAndUnloadAppDomain(String runMethod, AppDomain appDomain, Assembly assembly, Object[] args) [04:27:51]Type is not resolved for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications, Version=0.5.9.0, Culture=neutral, PublicKeyToken=null'. [04:27:57][JetBrains dotCover] Coverage session finished [15/10/2012 04:26:16] [04:27:57][JetBrains dotCover] Analysed application exited with code '-1'