diff --git a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllAfterTestHooksExecute.cs b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllAfterTestHooksExecute.cs index 426793fdde..82e915f84e 100644 --- a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllAfterTestHooksExecute.cs +++ b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllAfterTestHooksExecute.cs @@ -32,7 +32,6 @@ public void OneTimeTearDown() } [Test] - [NonParallelizable] public void TestProceedsAfterAllAfterTestHooksExecute() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllBeforeTestHooksExecute.cs b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllBeforeTestHooksExecute.cs index eafef7a937..3d14dc8794 100644 --- a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllBeforeTestHooksExecute.cs +++ b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionProceedsOnlyAfterAllBeforeTestHooksExecute.cs @@ -20,7 +20,6 @@ public void SomeTest() } [Test] - [NonParallelizable] public void CheckThatLongRunningBeforeTestHooksCompleteBeforeTest() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithAllPossibleHooks.cs b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithAllPossibleHooks.cs index dae197c0d1..8ff87dfdd3 100644 --- a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithAllPossibleHooks.cs +++ b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithAllPossibleHooks.cs @@ -43,7 +43,6 @@ public void OneTimeTearDown() } [Test] - [NonParallelizable] public void TestProceedsAfterAllAfterTestHooksExecute() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithTestActionTests.cs b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithTestActionTests.cs index d8d0cad053..baaf6e6f69 100644 --- a/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithTestActionTests.cs +++ b/src/NUnitFramework/tests/HookExtension/ExecutionSequence/ExecutionSequenceWithTestActionTests.cs @@ -51,7 +51,6 @@ public void OneTimeTearDown() } [Test] - [NonParallelizable] public void TestProceedsAfterAllAfterTestHooksExecute() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimSetUpHooksEvaluateTestOutcomeTests.cs b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimSetUpHooksEvaluateTestOutcomeTests.cs index f3d5998459..0cf3cfaf51 100644 --- a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimSetUpHooksEvaluateTestOutcomeTests.cs +++ b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimSetUpHooksEvaluateTestOutcomeTests.cs @@ -74,7 +74,6 @@ private static IEnumerable GetRelevantFailingReasons() } [TestSetupUnderTest] - [NonParallelizable] [AfterSetUpOutcomeLogger] [TestFixtureSource(nameof(GetFixtureConfig))] public class TestsUnderTestsWithDifferentOntTimeSetUpOutcome @@ -147,7 +146,7 @@ public void SomeTest() } [Test] - [NonParallelizable] + public void CheckSetUpOutcomes() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimeTearDownHooksEvaluateTestOutcomeTests.cs b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimeTearDownHooksEvaluateTestOutcomeTests.cs index 933269051c..9b0c74c103 100644 --- a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimeTearDownHooksEvaluateTestOutcomeTests.cs +++ b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterOneTimeTearDownHooksEvaluateTestOutcomeTests.cs @@ -77,7 +77,6 @@ private static IEnumerable GetRelevantFailingReasons() // H-TODO: enrich or write new test for exceptions from hooks [TestSetupUnderTest] - [NonParallelizable] [AfterOneTimeTearDownOutcomeLogger] [TestFixtureSource(nameof(GetFixtureConfig))] public class TestsUnderTestsWithDifferentOneTimeTearDownOutcome @@ -145,7 +144,7 @@ public void SomeTest() } [Test] - [NonParallelizable] + public void CheckOneTimeTearDownOutcomes() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterSetUpHooksEvaluateTestOutcomeTests.cs b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterSetUpHooksEvaluateTestOutcomeTests.cs index 682561f0a8..8754b62037 100644 --- a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterSetUpHooksEvaluateTestOutcomeTests.cs +++ b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterSetUpHooksEvaluateTestOutcomeTests.cs @@ -72,7 +72,6 @@ private static IEnumerable GetRelevantFailingReasons() } [TestSetupUnderTest] - [NonParallelizable] [AfterSetUpOutcomeLogger] [TestFixtureSource(nameof(GetFixtureConfig))] public class TestsUnderTestsWithDifferentSetUpOutcome @@ -146,7 +145,7 @@ public void SomeTest() } [Test] - [NonParallelizable] + public void CheckSetUpOutcomes() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTearDownHooksEvaluateTestOutcomeTests.cs b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTearDownHooksEvaluateTestOutcomeTests.cs index 0c0a8dd5ba..6108e7b9d5 100644 --- a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTearDownHooksEvaluateTestOutcomeTests.cs +++ b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTearDownHooksEvaluateTestOutcomeTests.cs @@ -70,7 +70,6 @@ private static IEnumerable GetRelevantFailingReasons() // H-TODO: enrich the test to also failing tests and setups [TestSetupUnderTest] - [NonParallelizable] [AfterTearDownOutcomeLogger] [TestFixtureSource(nameof(GetFixtureConfig))] public class TestsUnderTestsWithDifferentTearDownOutcome @@ -137,7 +136,7 @@ public void SomeTest() } [Test] - [NonParallelizable] + public void CheckTearDownOutcomes() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTestHooksEvaluateTestOutcome.cs b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTestHooksEvaluateTestOutcome.cs index ebd93b2726..a32e1bdd12 100644 --- a/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTestHooksEvaluateTestOutcome.cs +++ b/src/NUnitFramework/tests/HookExtension/TestOutcomeTests/AfterTestHooksEvaluateTestOutcome.cs @@ -47,7 +47,6 @@ TestResult testResult public class AfterTestHooksEvaluateTestOutcomeTests { [TestSetupUnderTest] - [NonParallelizable] [AfterTestOutcomeLogger] public class TestsUnderTestsWithMixedOutcome { @@ -89,7 +88,7 @@ public void WarningTestWithWarnings() } [Test] - [NonParallelizable] + public void CheckThatAfterTestHooksEvaluateTestOutcome() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/ThreadingTests/AsynchronousBeforeTestHookInvocationTests.cs b/src/NUnitFramework/tests/HookExtension/ThreadingTests/AsynchronousBeforeTestHookInvocationTests.cs index 6d9f378274..4d457d9bad 100644 --- a/src/NUnitFramework/tests/HookExtension/ThreadingTests/AsynchronousBeforeTestHookInvocationTests.cs +++ b/src/NUnitFramework/tests/HookExtension/ThreadingTests/AsynchronousBeforeTestHookInvocationTests.cs @@ -79,7 +79,6 @@ public void TestFails_WithException() } [Test] - [NonParallelizable] [Explicit("Thread IDs is not a good way to test. Are we testing dot net framework here??")] public void AsynchronousHookInvocation_HookExecutesInSeparateThreads() { diff --git a/src/NUnitFramework/tests/HookExtension/ThreadingTests/SynchronousHookInvocationTests.cs b/src/NUnitFramework/tests/HookExtension/ThreadingTests/SynchronousHookInvocationTests.cs index fcefc7ef51..d238f8f672 100644 --- a/src/NUnitFramework/tests/HookExtension/ThreadingTests/SynchronousHookInvocationTests.cs +++ b/src/NUnitFramework/tests/HookExtension/ThreadingTests/SynchronousHookInvocationTests.cs @@ -63,7 +63,6 @@ public void TestFails_WithException() } [Test] - [NonParallelizable] public void SynchronousHookInvocation_HookExecutesInSameThreadAsTest() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/HookExtension/TwoTests_WithAndWithoutLoggerHook_BeforeAfterTestOnlyOneTestLogged.cs b/src/NUnitFramework/tests/HookExtension/TwoTests_WithAndWithoutLoggerHook_BeforeAfterTestOnlyOneTestLogged.cs index f0a9f667b9..b5e7252c74 100644 --- a/src/NUnitFramework/tests/HookExtension/TwoTests_WithAndWithoutLoggerHook_BeforeAfterTestOnlyOneTestLogged.cs +++ b/src/NUnitFramework/tests/HookExtension/TwoTests_WithAndWithoutLoggerHook_BeforeAfterTestOnlyOneTestLogged.cs @@ -23,7 +23,6 @@ public void TestWithoutHookLogging() } [Test] - [NonParallelizable] public void CheckLoggingTest() { var testResult = TestsUnderTest.Execute(); diff --git a/src/NUnitFramework/tests/TestUtilities/TestsUnderTest/TestLog.cs b/src/NUnitFramework/tests/TestUtilities/TestsUnderTest/TestLog.cs index a8c441dda6..b403888723 100644 --- a/src/NUnitFramework/tests/TestUtilities/TestsUnderTest/TestLog.cs +++ b/src/NUnitFramework/tests/TestUtilities/TestsUnderTest/TestLog.cs @@ -2,12 +2,26 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; +using System.Threading; namespace NUnit.Framework.Tests.TestUtilities.TestsUnderTest; public static class TestLog { - public static List Logs { get; } = new List(); + private static readonly AsyncLocal> _logs = new AsyncLocal>(); + + // Each aync context gets its own instance of TestLog + public static List Logs + { + get + { + if (_logs.Value == null) + { + _logs.Value = new List(); + } + return _logs.Value; + } + } public static void Log(string infoToLog) {