Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:35:34+00:00 2026-06-05T15:35:34+00:00

SpecFlow is great – and it helps us very much to do proper integration

  • 0

SpecFlow is great – and it helps us very much to do proper integration testing.

One thing I was wondering is whether there’s a way to tell SpecFlow to add additional NUnit attributes to the test class it creates in the feature code-behind file.

Right now, my test class gets generated something like this:

[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.8.1.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Some action description here")]
public partial class MySampleFeature
{  
   ......
}

Is there any way in SpecFlow to tell it to add an additional NUnit attribute to define the category of the test – like this:

[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.8.1.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Some action description here")]
[NUnit.Framework.Category("LongRunningTests")]   <== add this "Category" attribute
public partial class MySampleFeature
{  
   ......
}

Adding this manually to the generated code-behind is wasteful – next time SpecFlow re-generates that code-behind, I have to remember doing it again (and chances are, I’ll forget).

And if that capability is not yet present in SpecFlow – how to petition for this to be added? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:35:36+00:00Added an answer on June 5, 2026 at 3:35 pm

    In fact the NUnit.Framework.Category attribute is already supported if you use tags (look for the tags section) on your feature or scenarios. So if you write

    @LongRunningTests
    Feature: MySampleFeature
    

    it will generate the proper Category attribute.

    However if you want to have additional custom attributes you need to write a custom generator provider with implementing the IUnitTestGeneratorProvider interface and register with the unitTestProvider‘s generatorProvider attribute in your config’s specflow section.

    You can find the source of the built in implementations at github.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I learned basics of web-based integration testing using SpecFlow and WatiN. From what I
Is there a Java or Scala equivalent to Cucumber / SpecFlow ? One possibility
Is there a way to integrate Visual Studio 2010 Coded UI Test with Specflow?
I'm using SpecFlow to do some BDD-style testing. Some of my features are UI
I've just come across BBD and specflow and it looks very interesting. When writing
Does any one have a solution to make the SpecFlow autocomplete in Visual Studio
On specflow's own instalation guide it says that the only way to install it
I'm trying to get Deleporter to do some cross process integration testing. The tests
I'm using SpecFlow for the automated Acceptance Testing framework and NHibernate for persistance. Many
I'm using Specflow with NUnit and WatiN to do some acceptance testing, and all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.