2. One thread per test - MSTest creates one thread per test. But tests are run sequentially without any order. Try below to verify
[TestMethod] public void TestMethod1() { System.Threading.Thread.Sleep(1000); TestContext.WriteLine("{0}", System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()); } [TestMethod] public void TestMethod2() { System.Threading.Thread.Sleep(1000); TestContext.WriteLine("{0}", System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()); } [TestMethod] public void TestMethod3() { System.Threading.Thread.Sleep(1000); TestContext.WriteLine("{0}", System.Threading.Thread.CurrentThread.ManagedThreadId.ToString()); }
3. If we have multiple cores, we can run tests parallel using this
No comments:
Post a Comment