SpecFlowOSS / SpecFlow.VisualStudio

Visual Studio extension of SpecFlow (extracted from the main SpecFlow repo)
Other
67 stars 73 forks source link

Unable to navigate from step with a separate stepAssembly and app.config not in the root folder #192

Closed itanneo closed 3 years ago

itanneo commented 3 years ago

Used Visual Studio

Visual Studio 2019

Are the latest Visual Studio updates installed?

Yes

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

Issue Description

When I try to navigate from a step of my feature, the step is not recognized. It appends when the step definition is in a different library and that the app.config defining the stepAssembly is not in the root folder of the project. However if I run the test, it works fine.

Workaround: if I copy the app.config in the root folder, it works. I suppose that the extension assumes that the app.config is in the root folder of the project and doesn't look at the property of the csproj.

Our app.config is shared between several projects, that's why it is not in the root folder of the project.

Steps to Reproduce

_ Have a project XXX.Test.SpecFlow that contains some steps

Link to Repository Project

No response

SabotageAndi commented 3 years ago

How do you get the app.config into your project? Do you have it as linked file?

itanneo commented 3 years ago

The config file path is defined in the csproj in the AppConfig tag as below: `

XXX.Integration.Nunit net472 false 7.2 true false ..\..\app.config`
itanneo commented 3 years ago

I saw in the code that the method VsSpecFlowConfigurationReader.GetConfigFileContent only searches in the folder of the project or in the projectitems. In our case, the app.config doesn't appear in the project items.

Maybe the VsSpecFlowConfigurationReader.GetConfigFileContent method could inspect the csproj and check if there's an "AppConfig" property ?

SabotageAndi commented 3 years ago

@itanneo probably, any desire for sending a PR to fix it?

itanneo commented 3 years ago

Sure, I'll give it a try after holidays.

Le 23 juillet 2021 17:15:44 GMT+02:00, Andreas Willich @.> a écrit : @. probably, any desire for sending a PR to fix it?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/SpecFlowOSS/SpecFlow.VisualStudio/issues/192#issuecomment-885710736

itanneo commented 3 years ago

Hello @SabotageAndi , As suggested, I proposed a PR: https://github.com/SpecFlowOSS/SpecFlow.VisualStudio/pull/193 I didn't find a way to access to the element value by using the Project/VsProject objects so I used XML parsing of the csproj to get it.