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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:54:08+00:00 2026-05-14T03:54:08+00:00

Is there an API for running Visual Studio Unit Tests programmatically? Running MSTests.exe with

  • 0

Is there an API for running Visual Studio Unit Tests programmatically?

Running MSTests.exe with Process.Start() does not work in the current scenario. What I’m looking for is something like the NUnit SimpleTestRunner.

Any ideas?

/Erik

  • 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-14T03:54:09+00:00Added an answer on May 14, 2026 at 3:54 am

    You’re correct in that there’s no public API for the mstest framework. I wrote a manual replacement for mstest one day to see how hard it was, and it’s not as simple as it looks (particularly if you want to take advantage of more than one CPU core), so beware of going down this path.

    Personally I’ve always just run mstest.exe programatically and then parsed the resulting .trx XML file. Are there any particular reasons why you can’t use Process.Start to run it?

    P.S. Some of the strange behaviour of mstest.exe are solved if you pass the /noisolation command line parameter – give that a go if you feel so inclined 🙂


    Update: Erik mentions he wants to run the test API in the current thread so he can set the thread culture for globalization issues.

    If you run a unit test under the debugger, you’ll notice that mstest creates a bunch of threads, and runs all your tests in different threads, so this isn’t likely to work even if you could access the API.

    What I’d suggest doing is this:

    1. From your test “runner” application, set an environment variable
    2. Run mstest pointing it at the specific tests
    3. Add a [ClassInitialize] (or [TestInitialize]) method which reads this environment variable and sets the culture
    4. Profit!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 374k
  • Answers 374k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The Spring session does not exactly match the HttpSession, and… May 14, 2026 at 7:58 pm
  • Editorial Team
    Editorial Team added an answer You can reset them: q:before,q:after{content:''} May 14, 2026 at 7:58 pm
  • Editorial Team
    Editorial Team added an answer This expression: (*test).what[z][x] is a float in the array (which… May 14, 2026 at 7:58 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.