"Run Functional Tests" 任务和 Specflow - App.config 被忽略?

"Run Functional Tests" task and Specflow - App.config being ignored?

我在 TFS 2015 更新 2 中创建了一个发布定义,如下所示:

我想将其用作我的 CI 流程的一部分。每次签入时,构建和单元测试都在专用的 BizTalk 构建服务器上执行。每晚执行,此(当前有问题的)版本应部署到 "DevTest" BizTalk 服务器并执行集成测试。

在最后一个 "Run Functional Tests" 任务之前一切正常。因此,BizTalk 应用程序被删除,然后以正确的顺序部署到目标服务器。 "IntegrationTests" 程序集包含一些使用 T运行smock 框架 (http://transmock.codeplex.com/) 的 Specflow 测试。这些测试的步骤包含在名为 "Common.Commponents" 的程序集中。这是从名为 "Finance.IntegrationTests.dll" 的测试程序集中引用的。在我的 Dev VM 上 运行 时测试通过。但是,当由 "Run Functional Tests" 任务执行时,出现以下错误:

Test method Finance.IntegrationTests.ASC_BacsFeature.BacsFileMoved threw exception: NUnit.Framework.InconclusiveException: No matching step definition found for one or more steps.using System;using TechTalk.SpecFlow;namespace MyNamespace{ [Binding] public class StepDefinitions { [Given(@"an output path specified by sso app '(.)' and setting '(.)'")]public void GivenAnOutputPathSpecifiedBySsoAppAndSetting(string p0, string p1){ ScenarioContext.Current.Pending();} [Given(@"the inpu

我已将测试项目的 App.config 设置为使用 MsTest,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
  </configSections>
  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
    <unitTestProvider name="MsTest"/>
    <stepAssemblies>
       <stepAssembly assembly="LCC.Integration.Common.Components" /> 
    </stepAssemblies>
  </specFlow>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration>

远程执行测试时,似乎使用了 NUnit 而不是 MSTest。

"Common.Components.dll"在之前版本通过GacUtil /I成功部署到GAC,不知道为什么找不到?

我已经尝试 运行直接在远程服务器上进行测试。我在 RDP 上,然后打开命令 window 和 运行 "vstest.console Finance.IntegrationTests.dll"。然后我收到无法找到测试输入文件的警告,随后出现错误,因为 "Could not load file or assembly 'nunit.framework'".

我认为问题在于,在远程执行测试时,未使用集成测试程序集的 App.config。这解释了为什么它尝试使用 NUnit 而不是 MSTest 以及为什么它无法绑定到公共步骤 - 因为它们的位置在节点中给出。

有人知道如何在远程测试时使用 App.config 吗?

有几个问题。我忘了 app.config 会被编译成 finance.integrationtests.dll.config。配置中对 dll 的引用需要具有完整的强名称,而不仅仅是名称。