Specflow decorators. Workable example
I'm trying to use specflow decorators to add a specific attribute to my generated methods.
To learn this issue, I downloaded your decorator example: https://github.com/SpecFlowOSS/SpecFlow-Examples/tree/master/Decorators/SampleMethodTagDecorator and made the simplest changes:
1. changed in MyMethodTagDecorator.cs TAG_NAME to "customDecorator"
2. changed tag name in Calculator.feature to "@customDecorator"
3. сhanged attribute in DecorateFrom(...) to "NUnit.Framework.Parallelizable". so now the method look like this:
public void DecorateFrom(string tagName, TestClassGenerationContext generationContext, CodeMemberMethod testMethod)
var attribute = new CodeAttributeDeclaration(
After these steps, when building the project in Calculator.feature.cs, the CategoryAttribute attribute of the AddTwoNumbers() method changed to "customDecorator", but the NUnit.Framework.Parallelizable attribute did not appear.
Can you please tell me why and what am I doing wrong?
one more question: is there an example of adding a certain attribute to a class and not to a method?
Please sign in to leave a comment.