Skip to content

feat(xunit logging): TestOutputHelperWireMockLogger - #1488

Merged
StefH merged 2 commits into
wiremock:masterfrom
Stepami:feature/xunit-factory
Jul 17, 2026
Merged

feat(xunit logging): TestOutputHelperWireMockLogger#1488
StefH merged 2 commits into
wiremock:masterfrom
Stepami:feature/xunit-factory

Conversation

@Stepami

@Stepami Stepami commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

Current implementation of the TestOutputHelperWireMockLogger obligates me to always have ready-to-use not null instance of ITestOutputHelper. It makes it quite uncomfortable to provide logging in cases when the WireMockServer is wrapped up in a xUnit fixture.

This PR extends applications of the TestOutputHelperWireMockLogger by allowing it to be constructed with Func<ITestOutputHelper>

Use Case

public class WireMockFixture
{
    public WireMockFixture()
    {
        WireMockServer = WireMockServer.Start(
            new WireMockServerSettings
            {
                Logger = new TestOutputHelperWireMockLogger(() => TestOutputHelper)
            });
    }

    public WireMockServer WireMockServer { get; }

    public void Dispose()
    {
        WireMockServer.Dispose();
        TestOutputHelper = null;
    }

    public ITestOutputHelper? TestOutputHelper { get; set; }
}

[CollectionDefinition(nameof(WireMockCollection))]
public class WireMockCollection : ICollectionFixture<WireMockFixture>;

[Collection(nameof(WireMockCollection))]
public class Tests
{
    public Tests(WireMockFixture fixture, ITestOutputHelper testOutputHelper)
    {
        fixture.TestOutputHelper = testOutputHelper;
    }
}

Минин Степан Александрович added 2 commits July 16, 2026 10:47
allow to provide current test output helper
made factory return nullable
@StefH StefH added the feature label Jul 17, 2026
@StefH
StefH merged commit d270ad7 into wiremock:master Jul 17, 2026
7 checks passed
This was referenced Jul 20, 2026
hangy pushed a commit to hangy/NLog.Targets.ApplicationInsights that referenced this pull request Aug 1, 2026
Updated [WireMock.Net](https://github.com/wiremock/WireMock.Net) from
2.12.0 to 2.13.0.

<details>
<summary>Release notes</summary>

_Sourced from [WireMock.Net's
releases](https://github.com/wiremock/WireMock.Net/releases)._

## 2.13.0

## What's Changed
* feat(xunit logging): TestOutputHelperWireMockLogger by @​Stepami in
wiremock/WireMock.Net#1488
* Swagger by @​StefH in
wiremock/WireMock.Net#1489
* Fix: Fully respect configured custom admin path (merge PR #​1483) by
@​StefH with @​Copilot in
wiremock/WireMock.Net#1490
* Add some more tests for WireMockList + move AdminPaths.cs file by
@​StefH in wiremock/WireMock.Net#1491


**Full Changelog**:
wiremock/WireMock.Net@2.12.0...2.13.0

Commits viewable in [compare
view](wiremock/WireMock.Net@2.12.0...2.13.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=WireMock.Net&package-manager=nuget&previous-version=2.12.0&new-version=2.13.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants