Skip to content

[ScenarioDependencies] in a project without StepBindings gives 'No method marked with [ScenarioDependencies] attribute found' (Reqnroll.Microsoft.Extensions.DependencyInjection) #477

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

Closed
304NotModified opened this issue Feb 20, 2025 · 7 comments · Fixed by #479
Labels
bug Something isn't working

Comments

@304NotModified
Copy link
Contributor

304NotModified commented Feb 20, 2025

Reqnroll Version

Reqnroll.Microsoft.Extensions.DependencyInjection 2.3.0

Which test runner are you using?

NUnit

.NET Implementation

.NET 8.0

Test Execution Method

ReSharper Test Runner

Content of reqnroll.json configuration file

{
  "$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
  "bindingAssemblies": [
    {
      "assembly": "Project1"
    },
    {
      "assembly": "Project2"
    }
  ]
}

Issue Description

[ScenarioDependencies] in a project without stepdefinitions (e.g. [Given], [When]) can't find the [ScenarioDependencies] method

This is with Microsoft.Extensions.DependencyInjection, I haven't checked the other plugins (autofac etc)

Steps to Reproduce

Given in reqnroll.json:

  "bindingAssemblies": [
    {
      "assembly": "Project1"
    },
    {
      "assembly": "Project2"
    }
  ]

In Project1 are stepdefinitions. In Project2 is the [ScenarioDependencies]

Then the [ScenarioDependencies] can't be found:

Reqnroll.Microsoft.Extensions.DependencyInjection.MissingScenarioDependenciesException : No method marked with [ScenarioDependencies] attribute found.

The issue is in
https://github.com/reqnroll/Reqnroll/blob/966d1c372bdef843d7a2e3ecd267e07722351d80/Plugins/Reqnroll.Autofac.ReqnrollPlugin/BindingRegistryExtensions.cs#L20C2-L25C10

called by

as this will get the assemblies from the stepdefinitions, while I assumed this would loop the assemblies from reqnroll.json

Link to Repro Project

No response

related #474

@304NotModified 304NotModified added the bug Something isn't working label Feb 20, 2025
@304NotModified
Copy link
Contributor Author

304NotModified commented Feb 20, 2025

I will try to fix this. I think we need
ITestRunnerManager.BindingAssemblies

Would be great if we could make a pre-release package on nuget then.

@304NotModified
Copy link
Contributor Author

304NotModified commented Feb 20, 2025

LOL I linked to autofac (was on mobile), so I guess that is an issue on autofac also.

update: that was dead code, fixed in #480

@304NotModified
Copy link
Contributor Author

304NotModified commented Feb 20, 2025

@Salgat I think you have this issue. Work around: add a fake binding to the assembly with [ScenarioDependencies]

Update: not sure if this is the same issue, as the code I checked in the autofac plugin was deadcode. So we still need a new github issue for that.

@gasparnagy
Copy link
Contributor

Would be great if we could make a pre-release package on nuget then.

We don't usually do pre-releases on nuget.org, because of the additional maintenance overhead, but every build contains a set of prerelease packages that can be downloaded and used from a folder source or uploaded to a private feed.

@304NotModified
Copy link
Contributor Author

Ok that's also OK 👍

@304NotModified
Copy link
Contributor Author

tested #479 and works well. See details in #479

@gasparnagy
Copy link
Contributor

Released in 2.4.0: https://github.com/orgs/reqnroll/discussions/515

@304NotModified 304NotModified marked this as a duplicate and then as not a duplicate of #467 Apr 3, 2025
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
2 participants