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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:50:35+00:00 2026-05-11T11:50:35+00:00

Ok, this is annoying. MSTest executes all of my tests simultaneously which causes some

  • 0

Ok, this is annoying.

MSTest executes all of my tests simultaneously which causes some of them to fail. No this is not because my tests are fragile and susceptible to build order rather it is because this is a demo project in which I use a Db4o object database running from a file.

So I have a couple of DataAccess tests checking that my repositories work correctly and boom, MSTest blows up. Since it tries to run all its tests at the same time it gets an error when a test tries to access the database file while other tests are using it.

Can anyone think of a quick way around this? I don’t want to ditch MSTest (ok I do but another story) and I sure as heck don’t want to run a full-blown database service so I’ll take any way to force MSTest not to run simultaneously or tricks with opening files.

Anyone have any ideas?

  • 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. 2026-05-11T11:50:36+00:00Added an answer on May 11, 2026 at 11:50 am

    You might want to try using a Monitor and entering in TestInitialize and exiting on TestCleanup. If your test classes all depend on the external file, you’ll need to use a single lock object for all of them.

    public static class LockClass {     public static object LockObject = new object(); }  ...  [TestInitialize] public void TestSetup() {      Monitor.Enter(LockClass.LockObject); }  [TestCleanup] public void TestCleanup() {      Monitor.Exit(LockClass.LockObject); } 

    This should force all of your tests to run serially and as long as all of your tests pass/fail they should run. If any of them throws an unexpected exception, though, all the rest will hang since the Exit code won’t be run for the test that blows up.

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

Sidebar

Related Questions

I have this annoying problem, that Im pretty sure happens to all of you
I am getting this annoying problem, whenever i do some changes to any file
I have this annoying method which pop up a MessageBox. So when I try
I'm getting this annoying error in one environment but not another and I can't
I have some integrtion tests that create an HSQL db from JPA entities. This
I have this annoying problem. I've used some kind of key combination and now
I am having this annoying problem which takes 10-20 seconds and sometimes more every
Yes, I'm yet another person to as this annoying question... but I'm not convinced
I`m getting this annoying warning : warning: 'AppDelegate' may not respond to '-presentModalViewController:animated:' In
I have this annoying problem with Internet Explorer. First some code, so it will

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.