SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.25k stars 754 forks source link

Question: Is there a way to add the NUnit "Order" attribute to the Feature file #2702

Closed bgoggan closed 1 year ago

bgoggan commented 1 year ago

SpecFlow Version

3.9.74

Which test runner are you using?

NUnit

Test Runner Version Number

3.9.74

.NET Implementation

.NET 6.0

Project Format of the SpecFlow project

Classic project format using <PackageReference> tags

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Visual Studio Test Explorer

SpecFlow Section in app.config or content of specflow.json

No response

Issue Description

Reading the NUnit documentation it appears you could add an Order attribute to the tests to ensure a particular order of execution. I'm wondering if there is a way for us to add that same attribute to either the Feature or Scenario level in Specflow?

Steps to Reproduce

N/A

Link to Repro Project

No response

Constante-ou-Mort commented 1 year ago

https://docs.specflow.org/projects/specflow/en/latest/Extend/Decorators.html

bgoggan commented 1 year ago

https://docs.specflow.org/projects/specflow/en/latest/Extend/Decorators.html

Thanks @Constante-ou-Mort I believe I followed all the documentation properly and yet when I attached my generator plugin package to my existing test package and add my "Order" attribute to the scenario nothing is created in the feature.cs file, other than the CategoryAttribute of "Order". I feel like my package isn't being recognized. I uploaded what I did at the link below. Would you be able to check it out and see if I'm missing anything?

https://github.com/bgoggan/SpecFlowPlugins

bgoggan commented 1 year ago

@gasparnagy @SabotageAndi Sorry to bother you both but I believe I followed the documentation sent in the link about creating a custom generator but I cannot get my tests to recognize it. Are either of you able to give a quick review of what I built in the link in my previous comment to see if I missed something? When I install the nuget package into my test projects and re-build I do not get an Order attribute added as expected but I cannot see why. Thanks in advance for any assistance you can provide.

gasparnagy commented 1 year ago

@bgoggan Please send me the code or the link. I'll try to check it.

bgoggan commented 1 year ago

@bgoggan Please send me the code or the link. I'll try to check it. @gasparnagy You need a link to my package assigned to a test project? I have the link to the generator package I built above?

gasparnagy commented 1 year ago

@bgoggan ah sorry. i meant the source code of the plugin, but i missed that you have shared the link already in your comment.

bgoggan commented 1 year ago

@gasparnagy no problem. I appreciate any help you can provide. Thanks.

gasparnagy commented 1 year ago

@bgoggan I'm doing a course this week until Thu, so it might be that I can only look at that on Friday. But I have it on my TODO list now.

bgoggan commented 1 year ago

@gasparnagy Sounds good. Thanks.

gasparnagy commented 1 year ago

@bgoggan Based on my quick review, I found:

bgoggan commented 1 year ago

@gasparnagy Wow, I can't believe it was something that simple. I didn't even see the warnings in the build but they jumped right out at me after your comment. I really appreciate your help on that. I made the suggested changes and I can now see the attribute being added. Have a great weekend. I'll close the ticket.

github-actions[bot] commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.