SpecFlowOSS / SpecFlow.VS

The next version of the Visual Studio extension for SpecFlow
MIT License
36 stars 10 forks source link

Specflow extension does not detect StepDefinitions in other assembly #126

Open informatorius opened 1 year ago

informatorius commented 1 year ago

Used Visual Studio

Visual Studio 2022

Are the latest Visual Studio updates installed?

Yes

SpecFlow Section in app.config or content of specflow.json

{
  "$schema": "https://specflow.org/specflow-config.json",

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

}

Issue Description

Specflow extension does not detect StepDefinitions in other assembly. I added a specflow.json with stepAssemblies section referencing my StepDefinitions.dll. But in feature file the steps are all in purple color and I cannot goto definition.

I have assembly reference from feature projects to StepDefinitions project.

In VS 2019 with deveroom extension where I used app.config additionally then it was working.

<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>
  <specFlow>
    <unitTestProvider name="NUnit" />
    <stepAssemblies>
      <stepAssembly assembly="StepDefinitions" />
    </stepAssemblies>
  </specFlow>
</configuration>

Steps to Reproduce

Open solution in VS 2022 with Specflow extension installed (both latest).

Open feature file and try to navigate to step definitions in other assembly

=> Specflow extension suggests to create new step definitions locally

Expected behavior: goto my already defined step definitions in other assembly

VS Output Specflow shows: Info: ThenImportStepDefinitions: 0 step definitions discovered for project SpecFlowProject2usingStepDefinitions

Link to Repository Project

Specflow Calculator Example stepAssemblies issue

VijayaSree2019 commented 1 year ago

I am facing the same issue. https://github.com/SpecFlowOSS/SpecFlow.VS/issues/122

psalters commented 1 year ago

I'm having the same issue but my logging shows something else:

Warning: AndDiscoveryProviderSucceed: Error during binding discovery. Command executed: C:\Git\adapto\cicd\internal\ads-atf\GherkinSuites\..\Output\Debug> C:\Program Files\dotnet\dotnet.exe exec c:\users\nlpsal\appdata\local\microsoft\visualstudio\17.0_4919afe6\extensions\symexjt2.mxf\Connectors\Generic-net6.0\specflow-vs.dll discovery C:\Git\adapto\cicd\internal\ads-atf\GherkinSuites\..\Output\Debug\ADS.GherkinSuites.dll C:\Git\adapto\cicd\internal\ads-atf\GherkinSuites\specflow.json Exit code: 0 Message: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: D. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at SpecFlow.VisualStudio.Connectors.OutProcSpecFlowConnector.Deserialize(RunProcessResult result, Func2 formatErrorMessage) Warning: AndDiscoveryProviderSucceed: The project bindings (e.g. step definitions) could not be discovered. Navigation, step completion and other features are disabled. Please check the error message above and report to https://github.com/SpecFlowOSS/SpecFlow.VS/issues if you cannot fix.