SpecFlow 3用于.NET CORE TEST运行服务器上的核心测试运行错误



我们的Teamcity Server无法运行.NET Core Project的SpecFlow 3测试。

我的家和工作站能够运行这些测试。

看来,在创建ASP.NET核心内存测试服务器Web服务器实例中,所有类型都被列举为DI容器设置的一部分。

无法加载文件或汇编'techtalk.specrun ...

System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types.
Could not load file or assembly 'TechTalk.SpecRun, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b'. The system cannot find the file specified.
Could not load file or assembly 'TechTalk.SpecRun.Common, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b'. The system cannot find the file specified.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeAssembly.get_DefinedTypes()
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
...
// Abridged here
...
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder, IFeatureCollection featureCollection)

搜索我的工作站,我可以找到以下匹配的组件。

FullName
--------
C:Usersluke.puplett.nugetpackagesspecrun.runner3.0.337toolsnet45TechTalk.SpecRun.dll
C:Usersluke.puplett.nugetpackagesspecrun.runner3.0.337toolsnetcoreapp2.0TechTalk.SpecRun.dll
C:Usersluke.puplett.nugetpackagesspecrun.runner3.0.337toolsnetcoreapp2.1TechTalk.SpecRun.dll
C:Usersluke.puplett.nugetpackagesspecrun.runner3.0.337toolsnetcoreapp2.2TechTalk.SpecRun.dll

我的测试项目引用了这些内容。请注意,SpecRun.Runner是包含丢失的汇编的软件包,尽管它在上面的tools中。嗯...

    <PackageReference Include="SpecFlow" Version="3.0.199" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.0.199" />
    <PackageReference Include="SpecFlow.xUnit" Version="3.0.199" />
    <PackageReference Include="SpecRun.Runner" Version="3.0.337" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">

我会继续努力并将报告。

我从git跟踪中删除了 feature.cs文件,因此我研究了这些文件仍在构建服务器上而未清理的想法。

其他查询词:CI CICD管道

您的问题在本文档中解决:

https://www.thetopsites.net/article/54438056.shtml

您必须做的是删除其中一个跑步者,即Specrun,并添加Specflow.Tools.MSbuild.Generation Nuget软件包,该软件包可以解决您的问题。

最新更新