From c07d3e937f2b92a2ca3ac43fea605d94cfd808fa Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 2 Aug 2024 09:43:18 +0200 Subject: [PATCH 1/3] pr-fix: correct merge w/ 'main' --- src/Arcus.Testing.Tests.Unit/Core/PollTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Arcus.Testing.Tests.Unit/Core/PollTests.cs b/src/Arcus.Testing.Tests.Unit/Core/PollTests.cs index e7c76fec..321122b2 100644 --- a/src/Arcus.Testing.Tests.Unit/Core/PollTests.cs +++ b/src/Arcus.Testing.Tests.Unit/Core/PollTests.cs @@ -35,9 +35,9 @@ public async Task PollAsync_WithTargetAvailableWithinTimeFrame_SucceedsByContinu await GetsResultAsync(() => Poll.UntilAvailableAsync(SometimesSucceedsResultAsync, ReasonableTimeFrame)); await GetsResultAsync(async () => await Poll.Target(AlwaysSucceedsResultAsync)); - await GetsResultAsync(async () => await Poll.Target(SometimesSucceedsResultAsync).LowestTimeFrame()); + await GetsResultAsync(async () => await Poll.Target(SometimesSucceedsResultAsync).ReasonableTimeFrame()); await GetsResultAsync(async () => await Poll.Target(AlwaysSucceedsResultAsync)); - await GetsResultAsync(async () => await Poll.Target(SometimesSucceedsResultAsync).LowestTimeFrame()); + await GetsResultAsync(async () => await Poll.Target(SometimesSucceedsResultAsync).ReasonableTimeFrame()); } [Fact] From b94ed5024ae7f2194497d3eab23fd31e367dcd2b Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:11:21 +0100 Subject: [PATCH 2/3] chore: eat your own logging dog food --- .../Arcus.Testing.Tests.Integration.csproj | 1 + .../IntegrationTest.cs | 3 +- .../Logging/XunitTestLogger.cs | 35 ------------------- 3 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 src/Arcus.Testing.Tests.Integration/Logging/XunitTestLogger.cs diff --git a/src/Arcus.Testing.Tests.Integration/Arcus.Testing.Tests.Integration.csproj b/src/Arcus.Testing.Tests.Integration/Arcus.Testing.Tests.Integration.csproj index 575e366d..2d21b2fb 100644 --- a/src/Arcus.Testing.Tests.Integration/Arcus.Testing.Tests.Integration.csproj +++ b/src/Arcus.Testing.Tests.Integration/Arcus.Testing.Tests.Integration.csproj @@ -25,6 +25,7 @@ + diff --git a/src/Arcus.Testing.Tests.Integration/IntegrationTest.cs b/src/Arcus.Testing.Tests.Integration/IntegrationTest.cs index b9691fe9..0b0f363d 100644 --- a/src/Arcus.Testing.Tests.Integration/IntegrationTest.cs +++ b/src/Arcus.Testing.Tests.Integration/IntegrationTest.cs @@ -1,5 +1,4 @@ -using Arcus.Template.Tests.Integration.Logging; -using Arcus.Testing.Tests.Integration.Configuration; +using Arcus.Testing.Tests.Integration.Configuration; using Bogus; using Microsoft.Extensions.Logging; using Xunit.Abstractions; diff --git a/src/Arcus.Testing.Tests.Integration/Logging/XunitTestLogger.cs b/src/Arcus.Testing.Tests.Integration/Logging/XunitTestLogger.cs deleted file mode 100644 index cc3b3ee0..00000000 --- a/src/Arcus.Testing.Tests.Integration/Logging/XunitTestLogger.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using GuardNet; -using Microsoft.Extensions.Logging; -using Xunit.Abstractions; - -namespace Arcus.Template.Tests.Integration.Logging -{ - public class XunitTestLogger : ILogger - { - private readonly ITestOutputHelper _testOutput; - - public XunitTestLogger(ITestOutputHelper testOutput) - { - Guard.NotNull(testOutput, nameof(testOutput)); - - _testOutput = testOutput; - } - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - var message = formatter(state, exception); - _testOutput.WriteLine($"{DateTimeOffset.UtcNow:s} {logLevel} > {message}"); - } - - public bool IsEnabled(LogLevel logLevel) - { - return true; - } - - public IDisposable BeginScope(TState state) - { - return null; - } - } -} From 0536b9d2f71b30e52500fc8eb347a8fa3c758e1d Mon Sep 17 00:00:00 2001 From: stijnmoreels <9039753+stijnmoreels@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:28:44 +0100 Subject: [PATCH 3/3] docs: explain multi-suite active session id --- .../02-Features/06-Integration/01-data-factory.mdx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/preview/02-Features/06-Integration/01-data-factory.mdx b/docs/preview/02-Features/06-Integration/01-data-factory.mdx index effe3864..6379e039 100644 --- a/docs/preview/02-Features/06-Integration/01-data-factory.mdx +++ b/docs/preview/02-Features/06-Integration/01-data-factory.mdx @@ -49,7 +49,16 @@ await TemporaryDataFlowDebugSession.StartDebugSessionAsync(..., options => }); ``` -> 💡 The `ActiveSessionId` is useful when developing locally when you do not want to start/stop the debug session on every run. But this also means that in case an active session is found, it will not be teardown when the test fixture disposes. This follows the 'clean environment' principle that test fixtures should only be responsible for the things they set up. +> #### 💡 Leveraging the `ActiveSessionId` option +> The `ActiveSessionId` is useful when developing locally when you do not want to start/stop the debug session on every run. But this also means that in case an active session is found, it will not be teardown when the test fixture disposes. This follows the 'clean environment' principle that test fixtures should only be responsible for the things they set up. +> +> ⚡ Because of this functionality, you can even use the same debug session across different test suites/projects. These things need to happen to set this up: +> +> 1. Run a **custom script** task before any of the test suites to start a debug session. +> 2. Set a new **pipeline variable with the session ID** of the active debug session. +> 3. Get the pipeline variable in your tests suites to assign it to the `ActiveSessionId` option. +> 4. Run a custom script after all the test suites to stop the debug session. +> * ⚠️ **_Make sure that this always runs, even if the tests fail._** ### Full example The following snippet provides a full examples of how the `TemporaryDataFlowDebugSession` test fixture can be used as a singleton test fixture across tests.