Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reqnroll.Autofac shows wrongly ambiguous step definition #56

Closed
maoso opened this issue Feb 27, 2024 · 5 comments · Fixed by #139
Closed

Reqnroll.Autofac shows wrongly ambiguous step definition #56

maoso opened this issue Feb 27, 2024 · 5 comments · Fixed by #139
Assignees
Labels
bug Something isn't working
Milestone

Comments

@maoso
Copy link

maoso commented Feb 27, 2024

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.
SpecFlowOSS/SpecFlow#2666 (comment)

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:
SpecFlowOSS/SpecFlow#2666 (comment)

Link to Repro Project

No response

@maoso maoso added the bug Something isn't working label Feb 27, 2024
@gasparnagy
Copy link
Contributor

@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
Copy link

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
Copy link
Contributor

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

@ajeckmans ajeckmans added this to the v2 milestone Apr 24, 2024
@ylqylqylq0328
Copy link

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
Copy link

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

@gasparnagy gasparnagy self-assigned this May 21, 2024
gasparnagy added a commit that referenced this issue May 21, 2024
* Refactor AutofacPlugin and add unit tests

* Add extension method to add bindings from assembly

* fix duplicate registrations bug

* fix typo

* Fix the fix and also #127

* Add CHANGELOG
gasparnagy added a commit that referenced this issue May 22, 2024
…ons-dependencyinjection-plugin

* origin/main: (21 commits)
  Fix #56 autofac ambiguous stepdef and hook required #127 issue (#139)
  Reduce target framework of Reqnroll to netstandard2.0 (#130)
  Fix StackOverflowException when using [StepArgumentTransformation] with same input and output type (#136)
  MsTest: Replace DelayedFixtureTearDown special case with ClassCleanupBehavior.EndOfClass (#128)
  Temporarily disabled tests until #132 is resolved
  Add NUnit & xUnit core tests to portability suite
  Capture ExecutionContext after every binding invoke (#126)
  small improvement in CodeDomHelper to be able to chain async calls
  fix method name sources in UnitTestFeatureGenerator
  External data plugin, support for JSON files  (#118)
  UnitTests: Check if SDK version is installed and if not ignore the test (#109)
  Fix 111 ignore attr not inherited from rule (#113)
  Update README.md (#110)
  Fix 81 - modified CucumberExpressionParameterTypeRegistry to handle multiple custom types used as cucumber expressions when those types share the same short name. (#104)
  Update index.md
  Simplify test project targets (#105)
  Make SystemTests temp folder configurable and use NUGET_PACKAGES env var to override global NuGet folder
  Fleshing out Generation System Tests (2) (#99)
  Fix for 81 - Cucumber Expression using Enums errors when two enums exist with the same short name (#100)
  Include BoDi to Reqnroll package (#91) (#95)
  ...

# Conflicts:
#	Reqnroll.sln
#	Tests/Reqnroll.PluginTests/Reqnroll.PluginTests.csproj
gasparnagy added a commit that referenced this issue May 22, 2024
…hread-container

* origin/main:
  Extract cucumber expression detection heuristic to an interface
  fix test artifact folder calculation
  Restructure solution folders (#141)
  cleanup CHANGELOG.md
  ignore generated file
  remove generated file
  bump version
  Add Microsoft.Extensions.DependencyInjection integration plugin (#94)
  Fix #56 autofac ambiguous stepdef and hook required #127 issue (#139)
  Reduce target framework of Reqnroll to netstandard2.0 (#130)
  Fix StackOverflowException when using [StepArgumentTransformation] with same input and output type (#136)

# Conflicts:
#	CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants