1

我已经安装了以下 NuGet:Specflow.Nunit、specflow、Specrun.Nunit 以及 NUnit 2.6.3。 我正在尝试执行 runtests.cmd(由 specrun.nunit 自动生成),但出现以下错误:

TechTalk.SpecRun.Framework.SpecRunException:至少一个测试线程中止。---> System.Reflection.TargetInvocationException:调用的目标已抛出异常。---> System.MissingMethodException:找不到方法:'Void TechTalk.SpecRun.SpecRunner.Initialize()'。 我的 default.srprofile 包含:

  <?xml version="1.0" encoding="utf-8"?>
    <TestProfile xmlns="http://www.specrun.com/schemas/2011/09/TestProfile">
      <Settings projectName="<PROJECTNAME>" projectId="{------}" />
      <Execution stopAfterFailures="3" testThreadCount="2" testSchedulingMode="Sequential" />
      <!-- For collecting by a SpecRun server update and enable the following element. For using the 
          collected statistics, set testSchedulingMode="Adaptive" attribute on the <Execution> element.
        <Server serverUrl="http://specrunserver:6365" publishResults="true" />
      -->
      <TestAssemblyPaths>
        <TestAssemblyPath>projectname.dll</TestAssemblyPath>
      </TestAssemblyPaths>
      <DeploymentTransformation>
        <Steps>`enter code here`
          <!-- sample config transform to change the connection string-->
          <!--<ConfigFileTransformation configFile="App.config">
            <Transformation>
              <![CDATA[<?xml version="1.0" encoding="utf-8"?>
                                <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
                    <connectionStrings>
                      <add name="MyDatabase" connectionString="Data Source=.;Initial Catalog=MyDatabaseForTesting;Integrated Security=True" 
                           xdt:Locator="Match(name)" xdt:Transform="SetAttributes(connectionString)" />
                    </connectionStrings>
                                </configuration>
                            ]]>
            </Transformation>
          </ConfigFileTransformation>-->
        </Steps>
      </DeploymentTransformation>
    </TestProfile>

同样在 VS 输出窗口上,我收到此错误:无法加载文件或程序集 'TechTalk.SpecRun, Version=1.3.0.76, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b' 或其依赖项之一。该系统找不到指定的文件。 有人可以帮我吗?

4

1 回答 1

0

你会改变这个字符串:

      <RelocateConfigurationFile target="CustomConfig.{TestThreadId}.config" />
      <ConfigFileTransformation configFile="App.config">

完整答案: https ://github.com/techtalk/SpecFlow/issues/954

于 2018-02-01T06:14:22.713 回答