Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
00c710e
chore: update xunit related package version to v3 with mtp v2
filzrev Mar 7, 2026
20c0bd1
chore: add using Xunit.Sdk statement for XunitSerializable
filzrev Mar 7, 2026
7d89536
chore: fix xUnit3003 analyzer errors
filzrev Mar 7, 2026
6f51d46
chore: modify theorydata related incompatible codes
filzrev Mar 7, 2026
c65dfb3
chore: add global.json to use Microsoft.Testing.Platform by dotnet test
filzrev Mar 28, 2026
5f7a3cf
chore: add tests/.editorconfig
filzrev Mar 29, 2026
53af690
chore: fix custom inlinedata attribute
filzrev Mar 29, 2026
b82d80a
chore: fix wasm related tests
filzrev Mar 29, 2026
4bea495
chore: suppress MSB3277 warnings
filzrev Mar 30, 2026
6e3252a
chore: migrate multipleframeworks tests to tunit
filzrev Mar 30, 2026
69788e6
chore: update build project to support mtp
filzrev Mar 30, 2026
befba9d
chore: fix run-tests-selected workflow
filzrev Apr 2, 2026
1eb6f47
chore: add PreferNativeArm64 setting to Directory.Build.targets
filzrev Apr 3, 2026
ab1f814
chore: add diagnostic logs and collect as artifacts
filzrev Apr 6, 2026
17a93d5
chore: update generate-coverage-report.yaml
filzrev Apr 6, 2026
5e539f8
chore: temporary skip disassemble tests for macos
filzrev Apr 6, 2026
2e6c5c5
chore: add isinprocess condition to skip tests
filzrev Apr 9, 2026
59cd632
chore: add consolecapture setting and parallel setting
filzrev Jun 1, 2026
d9fa154
chore: modify test to use dotnet run for simple output
filzrev Jun 2, 2026
960fb1e
chore: set default diag log level to warning and add --no-launchprofi…
filzrev Jun 3, 2026
35cf820
chore: update parallel settings that introduced on xunit v3 4.0.0-pre…
filzrev Jul 19, 2026
86de1af
chore: fix build error on build project
filzrev Jul 19, 2026
b794ea3
chore: remove ConsoleLogger to avoid dupicated log lines if [assembly…
filzrev Jul 19, 2026
50e5b1f
chore: add launchsettings.json per test projects
filzrev Jul 19, 2026
212a724
chore: fix ci error with line ending differences
filzrev Jul 19, 2026
2d7026d
chore: add setting to skip test when no test data
filzrev Jul 19, 2026
f0ee69f
chore: disable mtp and xunit entrypoint generation on benchmark project
filzrev Jul 19, 2026
d43ea8a
chore: add testconfig.json
filzrev Jul 20, 2026
f375d6c
chore: add telemetry/progress disable verification for some tests
filzrev Jul 22, 2026
bba6414
chore: disable progress on CI execution to avoid extra memory allocat…
filzrev Jul 22, 2026
7693452
chore: remove unused test filter and add parameters
filzrev Jul 22, 2026
67de370
chore: add setting to suppress dotnet cli telemetry
filzrev Jul 23, 2026
7eb5b47
chore: add skip setting for flaky test
filzrev Jul 23, 2026
2ab55d5
chore: temporary disable longRunningTest detection background worker
filzrev Jul 24, 2026
8e4acc7
chore: modify test condition for flaky tests
filzrev Jul 24, 2026
9a8ee0f
chore: remove temporary workaround setting for macos from ThreadingDi…
filzrev Jul 24, 2026
a7912ef
chore: remove validation logics because flaky test is reproduced on w…
filzrev Jul 25, 2026
de70e84
chore: update PerfonarTest based on latest update
filzrev Jul 28, 2026
17aae99
chore: pass cancellationtoken to benchmark executor
filzrev Aug 1, 2026
c46f213
chore: skip apphost verification on `browser-wasi` runtime also
filzrev Aug 1, 2026
3d0bd05
chore: add default cli options on testconfig.json
filzrev Aug 14, 2026
db2f5da
chore: update test related package deps
filzrev Aug 15, 2026
328f494
chore: add System.Configuration reference for .NET Framework
filzrev Sep 2, 2026
fc3bd1c
chore: skip flaky memorydiagnoser tests on win-arm64-netfx
filzrev Sep 15, 2026
d582edf
chore: cleanup memorydiagnoser tests skip conditions
filzrev Sep 16, 2026
15a341d
chore: enable some disassembler diagnoser tests on macos
filzrev Sep 22, 2026
bfc42b0
chore: add skip inprocess memorydiagnoser tests because it's flaky on…
filzrev Sep 22, 2026
9622fb8
chore: skip arm64 test that don't works on .NET Framework
filzrev Sep 22, 2026
d6f2758
chore: replace existing InlineDataEnvSpecificAttribute to xUnit build…
filzrev Sep 23, 2026
700faa6
chore: add SkipTestWithoutData
filzrev Oct 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Verify snapshot files must keep LF line endings on every platform.
# Verify.XunitV3 rejects a verified file that contains a CR with core.autocrlf.
*.verified.* text eol=lf
*.received.* text eol=lf
26 changes: 16 additions & 10 deletions .github/workflows/generate-coverage-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
type: boolean
description: Set `true` to skip integration tests.
default: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.skip_integration_tests }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true
Expand Down Expand Up @@ -37,6 +37,12 @@ jobs:
- name: Setup additional tools for Wasm/NativeAot tests
if: ${{ github.event.inputs.skip_integration_tests == 'false'}}
uses: ./.github/actions/setup-additional-tools

# createdump's task_for_pid makes authd evaluate system.privilege.taskport, which prompts for a password on these
# headless runners and blocks forever; pre-authorizing it lets in-process disassembly dump its own process.
- name: Allow task_for_pid without a password prompt
if: runner.os == 'macOS'
run: sudo security authorizationdb write system.privilege.taskport allow

- name: Install dotnet-coverage
run: dotnet tool install --global dotnet-coverage
Expand All @@ -49,13 +55,13 @@ jobs:

- name: Collect Code Coverage
run: |
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Tests -c Release --no-build --framework net10.0"
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Analyzers.Tests -c Release --no-build --framework net10.0"
dotnet coverage connect bdn_coverage "dotnet test --project tests/BenchmarkDotNet.Tests -c Release --no-build --framework net10.0 --no-ansi --output Detailed"
dotnet coverage connect bdn_coverage "dotnet test --project tests/BenchmarkDotNet.Analyzers.Tests -c Release --no-build --framework net10.0 --no-ansi --output Detailed"

- name: Collect Code Coverage for BenchmarkDotNet.IntegrationTests
if: ${{ github.event.inputs.skip_integration_tests == 'false'}}
run: |
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.IntegrationTests -c Release --no-build --framework net10.0"
dotnet coverage connect bdn_coverage "dotnet test --project tests/BenchmarkDotNet.IntegrationTests -c Release --no-build --framework net10.0 --no-ansi --output Detailed"

- name: Shutdown dotnet-coverage server.
run: dotnet coverage shutdown bdn_coverage --timeout 60000
Expand All @@ -77,7 +83,7 @@ jobs:
- name: Setup additional tools for Wasm/NativeAot tests
if: ${{ github.event.inputs.skip_integration_tests == 'false'}}
uses: ./.github/actions/setup-additional-tools

- name: Install dotnet-coverage
run: dotnet tool install --global dotnet-coverage

Expand All @@ -89,13 +95,13 @@ jobs:

- name: Collect Code Coverage
run: |
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Tests -c Release --no-build --framework net472"
dotnet coverage connect bdn_coverage "dotnet test tests/BenchmarkDotNet.Analyzers.Tests -c Release --no-build --framework net472"
dotnet coverage connect bdn_coverage "dotnet test --project tests/BenchmarkDotNet.Tests -c Release --no-build --framework net472 --no-ansi --output Detailed"
dotnet coverage connect bdn_coverage "dotnet test --project tests/BenchmarkDotNet.Analyzers.Tests -c Release --no-build --framework net472 --no-ansi --output Detailed"

- name: Collect Code Coverage for BenchmarkDotNet.IntegrationTests
if: ${{ github.event.inputs.skip_integration_tests == 'false'}}
- name: Collect Code Coverage for BenchmarkDotNet.IntegrationTests
if: ${{ github.event.inputs.skip_integration_tests == 'false'}}
run: |
dotnet coverage connect bdn_coverage 'dotnet test tests/BenchmarkDotNet.IntegrationTests -c Release --no-build --framework net472'
dotnet coverage connect bdn_coverage 'dotnet test --project tests/BenchmarkDotNet.IntegrationTests -c Release --no-build --framework net472 --no-ansi --output Detailed"

- name: Shutdown dotnet-coverage server.
run: dotnet coverage shutdown bdn_coverage --timeout 60000
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/run-tests-selected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ jobs:
- uses: ./.github/actions/add-windowsdefender-exclusions
if: runner.os == 'Windows'

# createdump's task_for_pid makes authd evaluate system.privilege.taskport, which prompts for a password on these
# headless runners and blocks forever; pre-authorizing it lets in-process disassembly dump its own process.
- name: Allow task_for_pid without a password prompt
if: runner.os == 'macOS'
run: sudo security authorizationdb write system.privilege.taskport allow

# Setup
- name: Create `artifacts` directory
run: |
Expand All @@ -89,12 +95,13 @@ jobs:
run: |
$PSNativeCommandUseErrorActionPreference = $true
$iterationCount = ${{ inputs.iteration_count }}

Write-Host ("OSArchitecture" + [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)

foreach($i in 1..$iterationCount) {
Write-Output ('##[group]Executing Iteration: {0}/${{ inputs.iteration_count }}' -f $i)

dotnet test -c Release --framework ${{ inputs.framework }} --filter ${{ inputs.filter }} -tl:off --no-build --logger "console;verbosity=normal"

dotnet test -c Release --framework ${{ inputs.framework }} --no-build --filter "${{ inputs.filter }}" --no-ansi --progress off --output Detailed
Write-Output '##[endgroup]'
}

Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ jobs:
if: always()
with:
name: test-windows-core-trx-${{ github.run_id }}-${{ matrix.os }}
path: "**/*.trx"
path: |
**/*.trx
**/log_*.diag

test-windows-full:
strategy:
Expand Down Expand Up @@ -100,7 +102,9 @@ jobs:
if: always()
with:
name: test-windows-full-trx-${{ github.run_id }}-${{ matrix.os }}
path: "**/*.trx"
path: |
**/*.trx
**/log_*.diag

test-linux:
strategy:
Expand Down Expand Up @@ -136,7 +140,9 @@ jobs:
if: always()
with:
name: test-linux-trx-${{ github.run_id }}-${{ matrix.os }}
path: "**/*.trx"
path: |
**/*.trx
**/log_*.diag

test-macos:
name: test-macos (${{ matrix.os.arch }})
Expand All @@ -154,6 +160,10 @@ jobs:
- name: Setup additional tools for Wasm/NativeAot tests
if: ${{ github.event.pull_request.draft != true }}
uses: ./.github/actions/setup-additional-tools
# createdump's task_for_pid makes authd evaluate system.privilege.taskport, which prompts for a password on these
# headless runners and blocks forever; pre-authorizing it lets in-process disassembly dump its own process.
- name: Allow task_for_pid without a password prompt
run: sudo security authorizationdb write system.privilege.taskport allow
# Build and Test
- name: Run task 'build'
run: ./build.cmd build
Expand All @@ -177,7 +187,9 @@ jobs:
if: always()
with:
name: test-macos(${{ matrix.os.arch }})-trx-${{ github.run_id }}
path: "**/*.trx"
path: |
**/*.trx
**/log_*.diag

test-pack:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions BenchmarkDotNet.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<Project Path="templates/BenchmarkDotNet.Templates.csproj" />
</Folder>
<Folder Name="/tests/">
<File Path="tests/.editorconfig" />
<File Path="tests/Directory.Build.props" />
<File Path="tests/Directory.Build.targets" />
<Project Path="tests/BenchmarkDotNet.Analyzers.Tests/BenchmarkDotNet.Analyzers.Tests.csproj" />
Expand Down
29 changes: 23 additions & 6 deletions build/BenchmarkDotNet.Build/Runners/UnitTestRunner.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using BenchmarkDotNet.Build.Helpers;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Test;
using Cake.Common.Tools.DotNet.Run;
using Cake.Core;
using Cake.Core.IO;
using System.Linq;
using System.Runtime.InteropServices;

namespace BenchmarkDotNet.Build.Runners;
Expand Down Expand Up @@ -32,19 +34,34 @@ public class UnitTestRunner(BuildContext context)
private DirectoryPath TestOutputDirectory { get; } = context.RootDirectory
.Combine("TestResults");

private DotNetTestSettings GetTestSettingsParameters(FilePath logFile, string tfm)
private DotNetRunSettings GetTestSettingsParameters(FilePath logFile, string tfm)
{
var settings = new DotNetTestSettings
// Enabled `Trace` level logging when debug logging is enabled on GitHub Actions.
// https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging
var diagnosticVerbosity = context.Environment.GetEnvironmentVariable("ACTIONS_STEP_DEBUG") == "true"
? "Trace"
: "Warning"; // Logging Warning/Error/Critical level logs by default.

var settings = new DotNetRunSettings
{
Configuration = context.BuildConfiguration,
Framework = tfm,
NoBuild = true,
NoRestore = true,
Loggers = new[] { "trx", $"trx;LogFileName={logFile.FullPath}", "console;verbosity=detailed" },
EnvironmentVariables =
{
["Platform"] = "" // force the tool to not look for the .dll in platform-specific directory
}
},
ArgumentCustomization = args
=> args.Append("--report-xunit-trx")
.AppendSwitchQuoted("--report-xunit-trx-filename", System.IO.Path.GetFileName(logFile.FullPath))
.Append("--no-ansi")
.AppendSwitch("--progress", "off")
.AppendSwitch("--output", "Detailed")
.AppendSwitch("--show-stdout", "Failed")
.Append("--diagnostic")
.AppendSwitch("--diagnostic-verbosity", diagnosticVerbosity)
.Append("--no-launch-profile"),
};
return settings;
}
Expand All @@ -58,7 +75,7 @@ private void RunTests(FilePath projectFile, string alias, string tfm)
var settings = GetTestSettingsParameters(trxFile, tfm);

context.Information($"Run tests for {projectFile} ({tfm}), result file: '{trxFile}'");
context.DotNetTest(projectFile.FullPath, settings);
context.DotNetRun(projectFile.FullPath, settings);
}

private void RunUnitTests(string tfm)
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
8 changes: 4 additions & 4 deletions src/BenchmarkDotNet/Exporters/HtmlExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public class HtmlExporter : ExporterBase
{
private const string CssDefinition = @"
<style type=""text/css"">
table { border-collapse: collapse; display: block; width: 100%; overflow: auto; }
td, th { padding: 6px 13px; border: 1px solid #ddd; text-align: right; }
tr { background-color: #fff; border-top: 1px solid #ccc; }
tr:nth-child(even) { background: #f8f8f8; }
table { border-collapse: collapse; display: block; width: 100%; overflow: auto; }
td, th { padding: 6px 13px; border: 1px solid #ddd; text-align: right; }
tr { background-color: #fff; border-top: 1px solid #ccc; }
tr:nth-child(even) { background: #f8f8f8; }
</style>";

protected override string FileExtension => "html";
Expand Down
11 changes: 11 additions & 0 deletions tests/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = false

# C# files
[*.cs]
# xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive.
dotnet_diagnostic.xUnit1051.severity = suggestion

# Verify settings
[*.{received,verified}.{txt}]
charset = utf-8-bom
trim_trailing_whitespace = false
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ public async Task Providing_expected_value_type_should_not_trigger_diagnostic(
{
var testCode = /* lang=c#-test */ $$"""
using DifferentNamespace;

using BenchmarkDotNet.Attributes;

public class BenchmarkClass
Expand Down Expand Up @@ -1188,7 +1188,7 @@ public void BenchmarkMethod({{integerValueAndType.Value2}} a)
}

public static IEnumerable<string> DummyAttributeUsage
=> DummyAttributeUsageTheoryData;
=> DummyAttributeUsageTheoryData.Select(x => x.Data);

public static TheoryData<string> EmptyArgumentsAttributeUsagesWithMismatchingValueCount()
{
Expand Down
Loading
Loading