From 9d7c784d6edd84f600405e6852359f837154f66b Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 22 Apr 2020 12:37:12 -0400 Subject: [PATCH] [Runners] Raise the start event before the tests executes. (#59) The OnTestStarted was being called in the HandleAfterTestStarting. That means that the event might not be raised if there is an issue with the test setup, making it hard to track. Moved the call to the HandleBeforeTestStarting to notify the test is going to strat which will execute before any issue occurs. fixes: https://github.com/dotnet/xharness/issues/54 --- .../xUnit/XUnitTestRunner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.XHarness.Tests.Runners/xUnit/XUnitTestRunner.cs b/src/Microsoft.DotNet.XHarness.Tests.Runners/xUnit/XUnitTestRunner.cs index 30d15f6a0..052789672 100644 --- a/src/Microsoft.DotNet.XHarness.Tests.Runners/xUnit/XUnitTestRunner.cs +++ b/src/Microsoft.DotNet.XHarness.Tests.Runners/xUnit/XUnitTestRunner.cs @@ -455,6 +455,8 @@ void HandleBeforeTestStarting(MessageHandlerArgs args) if (args == null || args.Message == null) return; + // notify that a method is starting + OnTestStarted(args.Message.Test.DisplayName); OnDiagnostic($"'Before' method for test '{args.Message.Test.DisplayName}' starting"); } @@ -471,8 +473,6 @@ void HandleAfterTestStarting(MessageHandlerArgs args) if (args == null || args.Message == null) return; - // notify that a method is starting - OnTestStarted(args.Message.Test.DisplayName); OnDiagnostic($"'After' method for test '{args.Message.Test.DisplayName}' starting"); }