Skip to content

Hooks are executed twice if Driver class is inherited #676

@gucu112

Description

@gucu112

Reqnroll Version

2.2.1

Which test runner are you using?

NUnit

Test Runner Version Number

3.14.0

.NET Implementation

.NET 8.0

Test Execution Method

Visual Studio Test Explorer

Content of reqnroll.json configuration file

No response

Issue Description

I have found weird behavior when inheriting from Driver class marked with [Binding] attribute and contains [BeforeScenario] and [AfterScenario] functions. If this situation occurs then Hooks are executed twice, which in my opinion is confusing and shouldn't happen.

I have prepared simple example on my github to demonstrate:
https://github.com/gucu112/ReqnrollBits/blob/master/BindingAttributeInheritance/StepDefinitions/CalculatorStepDefinitions.cs

When I ran the test I get this output:
Image

My first impression is that this behavior exists due to inheritance flag on [Bindings] attribute set to true (by default). However, I did not look through the code, so I am not really sure why it works like this.

Steps to Reproduce

Run the test in the project

Link to Repro Project

https://github.com/gucu112/ReqnrollBits

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