reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
310 stars 32 forks source link

Reqnroll.Autofac shows wrongly ambiguous step definition #56

Closed maoso closed 1 month ago

maoso commented 4 months ago

Reqnroll Version

1.0.1

Which test runner are you using?

NUnit

Test Runner Version Number

4.5.0

.NET Implementation

.NET 6.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

No response

Issue Description

When running reqnroll with the reqnroll autofac plugin, it shows ambiguous references into the steps same as was doing on specflow. Please check link for more information. https://github.com/SpecFlowOSS/SpecFlow/issues/2666#issuecomment-1935647024

Steps to Reproduce

When running reqnroll with the reqnroll autofac plugin, it shows ambiguous references into the steps same as was doing on specflow. Please check link for more information as is the same as it is described here: https://github.com/SpecFlowOSS/SpecFlow/issues/2666#issuecomment-1935647024

Link to Repro Project

No response

gasparnagy commented 4 months ago

@maoso If you open the VS extension log file in C:\Users\<your user>\AppData\Local\Reqnroll you will find lines like

2024-02-28T16:41:42.323+01:00, Verbose@425, RunDiscovery: C:\Temp\ReqnrollTest\ReqnrollProject4\ReqnrollProject4\bin\Debug\net6.0>C:\Program Files\dotnet\dotnet.exe exec C:\Users\gaspar\AppData\Local\Microsoft\VisualStudio\17.0_921b0c10\Extensions\dqgyecy1.ey0\Connectors\Reqnroll-Generic-net6.0\reqnroll-vs.dll discovery C:\Temp\ReqnrollTest\ReqnrollProject4\ReqnrollProject4\bin\Debug\net6.0\ReqnrollProject4.dll 

Try to run this command from a console (you might need to add some " if you had space in the name):

C:\Temp\ReqnrollTest\ReqnrollProject4\ReqnrollProject4\bin\Debug\net6.0>dotnet exec C:\Users\gaspar\AppData\Local\Microsoft\VisualStudio\17.0_921b0c10\Extensions\dqgyecy1.ey0\Connectors\Reqnroll-Generic-net6.0\reqnroll-vs.dll discovery C:\Temp\ReqnrollTest\ReqnrollProject4\ReqnrollProject4\bin\Debug\net6.0\ReqnrollProject4.dll 

and check the result. This should contain all discovered step definitions. Do you see the duplicate step definitions also there?

lms-swhite commented 4 months ago

Also having the ambiguous steps issue as described in the opening post. I ran the command you mentioned @gasparnagy from my logs and with Reqnroll.Autofac NuGet package installed it duplicates all the steps. If I remove the NuGet package and rebuild then the steps are no longer duplicated when you run the command, at the cost of Autofac no longer working.

gasparnagy commented 4 months ago

Thx for the input @lms-swhite. I will check.

ylqylqylq0328 commented 2 months ago

I have 2 reqnroll projects A and B in a solution. A use reqnroll.autofac plugin, and only contains step file and doesn't contain feature file; B doesn't use reqnroll.autofac pulgin, but uses bindings from external projects A. B contains feature file and step file. In the feature, if step is defined in B itself, it shows wrongly ambiguous step definition; if step is defined in external project A, it works well. Notes, Project B doesn't use reqnroll.autofac plugin directly, as well as Project A uses reqnroll.autofac plugin directly

ylqylqylq0328 commented 2 months ago

Based on my comments yesterday, now I have fixed this issue temporary. I separate my Project B into 2 projects, B1 and B2. B1 only contains feature file; B2 only contains step definition file. B1 features invokes step definition from B2 and A, so it never show ambiguous step definition