Skip to content

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

@304NotModified

Description

@304NotModified

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions