如何使用Specrun for NUnit实现并行执行

时间:2016-10-14 12:28:05

标签: nunit specflow specrun

我安装了以下NuGets: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 Output窗口中我收到此错误: 无法加载文件或程序集&#39; TechTalk.SpecRun,Version = 1.3.0.76,Culture = neutral,PublicKeyToken = d0fc5cc18b3b389b&#39;或其中一个依赖项。该系统找不到指定的文件。  有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

您可以更改此字符串:

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

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