Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
cc4c664
chore: update xunit related package version to v3 with mtp v2
filzrev Mar 7, 2026
d410cfa
chore: add using Xunit.Sdk statement for XunitSerializable
filzrev Mar 7, 2026
115331f
chore: fix xUnit3003 analyzer errors
filzrev Mar 7, 2026
2c702ce
chore: modify theorydata related incompatible codes
filzrev Mar 7, 2026
70c9ff0
chore: add global.json to use Microsoft.Testing.Platform by dotnet test
filzrev Mar 28, 2026
b5f2394
chore: add tests/.editorconfig
filzrev Mar 29, 2026
860cda3
chore: fix custom inlinedata attribute
filzrev Mar 29, 2026
95efe88
chore: fix wasm related tests
filzrev Mar 29, 2026
51e377c
chore: suppress MSB3277 warnings
filzrev Mar 30, 2026
e076117
chore: migrate multipleframeworks tests to tunit
filzrev Mar 30, 2026
c0ffed6
chore: update build project to support mtp
filzrev Mar 30, 2026
c876f98
chore: suppress auto-entrypoint generation of benchmark project templ…
filzrev Mar 30, 2026
027db5b
chore: fix run-tests-selected workflow
filzrev Apr 2, 2026
18af394
chore: add PreferNativeArm64 setting to Directory.Build.targets
filzrev Apr 3, 2026
d7c932f
chore: cleanup compile item references and file name
filzrev Apr 6, 2026
0c34aa2
chore: add diagnostic logs and collect as artifacts
filzrev Apr 6, 2026
7faf1ee
chore: update generate-coverage-report.yaml
filzrev Apr 6, 2026
47fd3cb
chore: temporary skip disassemble tests for macos
filzrev Apr 6, 2026
54aa81e
chore: add isinprocess condition to skip tests
filzrev Apr 9, 2026
57bab49
chore: add consolecapture setting and parallel setting
filzrev Jun 1, 2026
1de6e67
chore: modify test to use dotnet run for simple output
filzrev Jun 2, 2026
1cc9663
chore: set default diag log level to warning and add --no-launchprofi…
filzrev Jun 3, 2026
cc01d62
chore: update parallel settings that introduced on xunit v3 4.0.0-pre…
filzrev Jul 19, 2026
bd8a624
chore: fix build error on build project
filzrev Jul 19, 2026
5b47b9d
chore: remove ConsoleLogger to avoid dupicated log lines if [assembly…
filzrev Jul 19, 2026
3b2b73c
chore: add launchsettings.json per test projects
filzrev Jul 19, 2026
150c713
chore: fix ci error with line ending differences
filzrev Jul 19, 2026
da05e50
chore: add setting to skip test when no test data
filzrev Jul 19, 2026
682f53e
chore: disable mtp and xunit entrypoint generation on benchmark project
filzrev Jul 19, 2026
a107d10
chore: add testconfig.json
filzrev Jul 20, 2026
dfaec2f
chore: add telemetry/progress disable verification for some tests
filzrev Jul 22, 2026
528af74
chore: disable progress on CI execution to avoid extra memory allocat…
filzrev Jul 22, 2026
9d12244
chore: remove unused test filter and add parameters
filzrev Jul 22, 2026
5394b7f
chore: add setting to suppress dotnet cli telemetry
filzrev Jul 23, 2026
9bb987d
chore: add skip setting for flaky test
filzrev Jul 23, 2026
e5de9c5
chore: temporary disable longRunningTest detection background worker
filzrev Jul 24, 2026
c6e73d3
chore: modify test condition for flaky tests
filzrev Jul 24, 2026
9192755
chore: remove temporary workaround setting for macos from ThreadingDi…
filzrev Jul 24, 2026
e1aee6f
chore: remove validation logics because flaky test is reproduced on w…
filzrev Jul 25, 2026
f8a6416
chore: update PerfonarTest based on latest update
filzrev Jul 28, 2026
298b685
chore: pass cancellationtoken to benchmark executor
filzrev Aug 1, 2026
1d15b5a
chore: skip apphost verification on `browser-wasi` runtime also
filzrev Aug 1, 2026
822a8eb
chore: add default cli options on testconfig.json
filzrev Aug 14, 2026
240a9cc
chore: update test related package deps
filzrev Aug 15, 2026
271606b
chore: add flaky test skip code
filzrev Aug 15, 2026
5783813
chore: re-enable System.Configuration reference for .NET Framework
filzrev Aug 15, 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
20 changes: 10 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 @@ -49,13 +49,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 +77,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 +89,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
5 changes: 3 additions & 2 deletions .github/workflows/run-tests-selected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,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
16 changes: 12 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 Down Expand Up @@ -177,7 +183,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 @@ -28,6 +28,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
2 changes: 1 addition & 1 deletion src/BenchmarkDotNet/Templates/MonoAOTLLVMCsProj.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" DefaultTarget="Publish">
<Project Sdk="Microsoft.NET.Sdk" DefaultTarget="Publish">
<PropertyGroup>
<OriginalCSProjPath>$CSPROJPATH$</OriginalCSProjPath>
<MonoPropsPath>$([System.IO.Path]::ChangeExtension('$(OriginalCSProjPath)', '.Mono.props'))</MonoPropsPath>
Expand Down
4 changes: 3 additions & 1 deletion src/BenchmarkDotNet/Templates/WasmCsProj.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="$SDKNAME$" DefaultTargets="publish">
<Project Sdk="$SDKNAME$" DefaultTargets="publish">
<PropertyGroup>
<OriginalCSProjPath>$CSPROJPATH$</OriginalCSProjPath>
<WasmPropsPath>$([System.IO.Path]::ChangeExtension('$(OriginalCSProjPath)', '.Wasm.props'))</WasmPropsPath>
Expand Down Expand Up @@ -27,6 +27,8 @@ $CORECLR_OVERRIDES$
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
<EnableDefaultWasmAssembliesToBundle>false</EnableDefaultWasmAssembliesToBundle>
<StartupObject>BenchmarkDotNet.Autogenerated.UniqueProgramName</StartupObject>
<!-- Suppress error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'browser-wasm'. -->
<UseAppHost>false</UseAppHost>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private string GenerateProjectForNuGetBuild(string projectFilePath, BuildPartiti
<DebugSymbols>false</DebugSymbols>
<RunAnalyzers>false</RunAnalyzers>
<PublishAot>true</PublishAot>
<IsTestingPlatformApplication>false</IsTestingPlatformApplication>
<IlcOptimizationPreference>{ilcOptimizationPreference}</IlcOptimizationPreference>
<OptimizationPreference>{ilcOptimizationPreference}</OptimizationPreference>
{GetTrimmingSettings()}
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 @@ -559,7 +559,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 @@ -1114,7 +1114,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