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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:18:09+00:00 2026-06-04T12:18:09+00:00

I have a nunit class library containing test cases. I want to programmatically get

  • 0

I have a nunit class library containing test cases. I want to programmatically get a list of all tests in the library, mainly the test names and their test ids. Here is what I have so far:

var runner = new NUnit.Core.RemoteTestRunner();
runner.Load(new NUnit.Core.TestPackage(Request.PhysicalApplicationPath + "bin\\SystemTest.dll"));
var tests = new List<NUnit.Core.TestResult>();
foreach (NUnit.Core.TestResult result in runner.TestResult.Results)
{
    tests.Add(result);
}

The issue is that runner.TestResult is null until you actually run the tests. I obviously don’t want to run the tests at this point, I just want to get a list of which tests are in the library. After that, I will give users the ability to select a test and run it individually, passing in the test id to the RemoteTestRunner instance.

So how can I get the list of tests without actually running all of them?

  • 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-04T12:18:10+00:00Added an answer on June 4, 2026 at 12:18 pm

    You could use reflection to load the assembly and look for all the test attributes. This would give you all the methods that are test methods. The rest is up to you.

    Here is an example on msdn about using reflection to get the attributes for a type.
    http://msdn.microsoft.com/en-us/library/z919e8tw.aspx

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

Sidebar

Related Questions

I have some class libraries with NUnit tests, and I want to convert the
I'm using NUnit for my unit tests and I have my unit test class
I have several suites of integration tests implemented in C#/NUNit. Each test suite is
I have a solution that has three projects: WPF Application Class Library NUnit Testing
Suppose I have a class library cl1 and a unit test for it that
I have some assembly that references NUnit and creates a single test class with
Today I ran into the following problem with NUnit. I have a class, that
I have a Nunit test which adds message into MSMQ. In the teardown of
I have an nunit Test in C#, that calls a C# wrapper of a
I have multiple Nunit test DLL's like a_test.dll, b_test.dll, c_test.dll. Whenever I need to

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.