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 1015205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:21:58+00:00 2026-05-16T10:21:58+00:00

I’m using NUnit 2.5.3, but if a more recent version of NUnit solves my

  • 0

I’m using NUnit 2.5.3, but if a more recent version of NUnit solves my problem, it won’t be an issue to upgrade.

We have a couple of different categories for tests. Different categories of tests will be run during different flavours of build (fast running unit tests for checkins, all unit tests and other tests with external dependencies (database etc.) for overnighters etc.). Divorcing the true unit tests and the tests with external dependencies into different assemblies is a longer term objective, but I’ll still want to enforce categories on the tests.

I want to ensure that all test methods have a single CategoryAttribute defined with a valid category name. A valid category name would be one from a list that I could define. However, just enforcing a Category on each test method would be a step in the right direction.

Does NUnit supports this kind of behaviour out of the box? Is there another NUnit attribute I can use other than CategoryAttribute which supports that kind of enforcement? Or is implementing a custom build step which checks the assemblies via reflection the way to go?

  • 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-05-16T10:21:58+00:00Added an answer on May 16, 2026 at 10:21 am

    I don’t think there is a way to ensure that all tests are marked with the Category attribute – that’s why I always split different types of tests into different assemblies (it shouldn’t be too hard to split a legacy assembly, especially if you are using tools like Resharper). So you would have to write your own tool as you said which would load the assembly and do validation.

    Also, these ideas might help:

    1. You can place the Category attribute on the TestFixture level, this way it will be a bit easier to remember about it and do the validation

    2. You can create custom attributes derived from the Category attribute. This way its easier to ensure that there are no spelling mistakes in category names

    See: http://www.nunit.org/index.php?p=category&r=2.4.8

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

Sidebar

Related Questions

No related questions found

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.