1

I'm tring use 2 projects in SpecFlow.

The first project has name: FrontEnd.Tests There are SpecFlow's Features and Steps (Definitions)

The second project: FrontEnd.Tests.Extended So, In second project I added in App.config

  <specFlow>
    <unitTestProvider name="MsTest" />
    <stepAssemblies>
      <stepAssembly assembly="FrontEnd.Tests" />
    </stepAssemblies>
  </specFlow>

To use steps definitions from 1st project. But I get error:

System.IO.FileNotFoundException: Could not load file or assembly 'FrontEnd.Tests' or one of its dependencies.

Projects are in the same directory.

Jester
  • 56,577
  • 4
  • 81
  • 125
Denis Evseev
  • 1,660
  • 1
  • 18
  • 33

4 Answers4

1

Try this, add a file with name specflow.json and reference your assemblies in there:

{
  "stepAssemblies": [ 
    { "stepAssembly": "FrontEnd.Tests" } 
  ]
}
AimusSage
  • 696
  • 4
  • 5
0

I think you need to put .dll on the end of the file name:

<specFlow>
  <unitTestProvider name="MsTest" />
  <stepAssemblies>
    <stepAssembly assembly="FrontEnd.Tests.dll" />
  </stepAssemblies>
</specFlow>
Sam Holder
  • 32,535
  • 13
  • 101
  • 181
0

For those in .net core you need to exclude the ".dll" extension and the file is specflow.json and set the properties like so:

enter image description here

ronnie
  • 494
  • 3
  • 4
0

For those working with .netCore and VSCode and/or dotnet-cli you need to do 2 things:

First: specify the additional assembly in the specflow.json file (just the name of the file without .dll extension)

{
   "stepAssemblies": [
      { "assembly": "AssemblyWithStepDefs" }
    ]
}

Second: modify the project file (.csproj) so the specflow.json file is always copied to the output directory

  <ItemGroup>
    <None Update="specflow.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
NicoPaez
  • 426
  • 2
  • 12