Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
71b26d7
Add docs for Microsoft.Testing.Platform integration
sheddy123 Aug 7, 2026
8918420
Add InternalsVisibleTo for TestAdapter.TestingPlatform
sheddy123 Aug 7, 2026
3dd5796
Remove GetUnrandomizedJobDisplayInfo method
sheddy123 Aug 7, 2026
695ee48
Add BenchmarkCaseIdentityExtensions for stable job IDs
sheddy123 Aug 7, 2026
770bd0d
Refactor benchmark extraction into reusable method
sheddy123 Aug 7, 2026
0fa20cd
Integrate BenchmarkDotNet with Microsoft.Testing.Platform
sheddy123 Aug 7, 2026
a97a8f1
Add AsyncWorkQueue for async work item processing
sheddy123 Aug 7, 2026
ff50c12
Add BenchmarkDotNet.TestAdapter.TestingPlatform project
sheddy123 Aug 7, 2026
46e4df0
Add BenchmarkDotNetExtension for platform integration
sheddy123 Aug 7, 2026
2a004cc
Add BenchmarkEventProcessor for test node event handling
sheddy123 Aug 7, 2026
76fd7da
Add BenchmarkTestFramework for test discovery/execution
sheddy123 Aug 7, 2026
aeba977
Add BenchmarkTestNode for test platform integration
sheddy123 Aug 7, 2026
d080886
Add OutputDeviceLogger to forward logs to output device
sheddy123 Aug 7, 2026
d155fac
Add extension methods to register BenchmarkDotNet as test framework
sheddy123 Aug 7, 2026
41e2099
Add TestingPlatformBuilderHook for BenchmarkDotNet integration
sheddy123 Aug 7, 2026
e7fb119
Add test runner config to global.json
sheddy123 Aug 7, 2026
9838f57
Add IntegrationTests.TestingPlatform project for net10.0
sheddy123 Aug 7, 2026
b84f3b8
Add SampleBenchmarks for fast in-process BDN testing
sheddy123 Aug 7, 2026
d5d3c0b
Add TestingPlatform projects and update test build configs
sheddy123 Aug 7, 2026
a14552f
Merge branch 'master' into feature/mtp-test-adapter-2803
sheddy123 Aug 12, 2026
f420e45
Update slnx to exclude two projects from Debug build
sheddy123 Aug 12, 2026
61ce3f1
Update docs, namespaces, and add GetBenchmarkUid method
sheddy123 Aug 15, 2026
4a27390
Remove BenchmarkDotNet.TestAdapter.TestingPlatform project
sheddy123 Aug 15, 2026
e544444
Integrate BenchmarkDotNet with Microsoft.Testing.Platform
sheddy123 Aug 15, 2026
7da9979
Add AsyncWorkQueue for ordered async work processing
sheddy123 Aug 15, 2026
2d945bf
Add BenchmarkDotNet.TestingPlatform integration
sheddy123 Aug 15, 2026
2158052
Update project references to TestingPlatform project
sheddy123 Aug 15, 2026
6777165
Refactor solution file project entries
sheddy123 Aug 15, 2026
8396103
Update props packaging and cSpell dictionary
sheddy123 Aug 15, 2026
cd523d5
Add generic benchmark for closed generic type testing
sheddy123 Aug 16, 2026
9f2cacb
Handle benchmark UID collisions during discovery/run
sheddy123 Aug 16, 2026
539cc5b
Adjust whitespace around [PublicAPI] attribute
sheddy123 Aug 16, 2026
f5af28f
Remove AsyncWorkQueue and related async queue logic
sheddy123 Aug 16, 2026
fc1a8da
Refactor to use ChannelWriter for log task queuing
sheddy123 Aug 16, 2026
52d46c7
Replace AsyncWorkQueue with Channel for event processing
sheddy123 Aug 16, 2026
b975930
Merge branch 'master' into feature/mtp-test-adapter-2803
sheddy123 Aug 16, 2026
8b4492e
Switch to GetUniqueId for benchmark case identification
sheddy123 Aug 16, 2026
9f32980
Move TestingPlatform config to .targets; cleanup props/csproj
sheddy123 Aug 16, 2026
1f73e5b
Update docs for new TestAdapter and MTP integration
sheddy123 Aug 16, 2026
68be1e2
Update namespaces and extension UID for adapter alignment
sheddy123 Aug 16, 2026
9deb942
Manually import TestAdapter build files in sample projects
sheddy123 Aug 16, 2026
9c81559
Update project to use BenchmarkDotNet.TestAdapter
sheddy123 Aug 16, 2026
8b128f5
Update packaging and entry point logic for test adapter
sheddy123 Aug 16, 2026
bd91fe3
Remove BenchmarkDotNet.TestingPlatform project
sheddy123 Aug 16, 2026
fe3143e
Simplify project entry in BenchmarkDotNet.slnx
sheddy123 Aug 22, 2026
857dc66
Update assistant introduction message
sheddy123 Aug 22, 2026
580eb35
Refactor method display name handling in BenchmarkDotNet
sheddy123 Aug 22, 2026
5311e65
Add DescribedProbe benchmark class with custom config
sheddy123 Aug 22, 2026
fdeac60
Add BenchmarkDotNet.IntegrationTests.TestingPlatform to tests
sheddy123 Aug 30, 2026
b6e386d
Format: Re-add InternalsVisibleTo line without changes
sheddy123 Aug 30, 2026
32a3793
Improve MSBuild property logic in TestAdapter.targets
sheddy123 Aug 30, 2026
cbaa04f
Clarify XML doc for --treenode-filter option
sheddy123 Aug 30, 2026
27294a8
Ensure thread-safe build completion in BenchmarkEventProcessor
sheddy123 Aug 30, 2026
6dc7429
Clarify XML doc: correct CLI arg to --treenode-filter
sheddy123 Aug 30, 2026
eb40140
Clarify comment to reference --treenode-filter option
sheddy123 Aug 30, 2026
5ff83aa
Add smoke test step for BenchmarkDotNet.TestAdapter
sheddy123 Aug 31, 2026
7a32578
Add sample consumer project for BenchmarkDotNet.TestAdapter
sheddy123 Aug 31, 2026
f1b10de
Add .csproj for TestingPlatform.Failures integration tests
sheddy123 Aug 31, 2026
5ff52b2
Add SeparatorProbe benchmark with FastConfig setup
sheddy123 Aug 31, 2026
53c3d60
Add BuildFailureProbe for build failure testing
sheddy123 Aug 31, 2026
c30b2ce
Add CollisionProbe test for parameter collision handling
sheddy123 Aug 31, 2026
8b4994e
Add OutOfProcessProbe for out-of-process benchmark test
sheddy123 Aug 31, 2026
09485e9
Add conditional refs for TestingPlatform probe projects
sheddy123 Aug 31, 2026
22759aa
Add TestingPlatformAdapterTests for integration testing
sheddy123 Aug 31, 2026
af7c019
Escape '/' as '%2F' in BenchmarkTestNode parameters
sheddy123 Aug 31, 2026
ba88cc9
Document percent-encoding in filter path
sheddy123 Aug 31, 2026
61fa92e
Add smoke test script for BenchmarkDotNet.TestAdapter
sheddy123 Aug 31, 2026
8745d4a
Enable optimizations in project file for benchmarks
sheddy123 Aug 31, 2026
3ad8984
Document TestingPlatform.Failures project in README
sheddy123 Aug 31, 2026
67c9996
Add Failures test project to BenchmarkDotNet.slnx
sheddy123 Aug 31, 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 .github/workflows/run-tests-selected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ on:
- tests/BenchmarkDotNet.IntegrationTests
- tests/BenchmarkDotNet.IntegrationTests.ManualRunning
- tests/BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks
# This one is a Microsoft.Testing.Platform application. It carries the `global.json` which routes
# `dotnet test` to the platform, and that file is resolved from the working directory, which this
# workflow sets to the project.
- tests/BenchmarkDotNet.IntegrationTests.TestingPlatform
- samples/BenchmarkDotNet.Samples
framework:
type: choice
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ jobs:
- uses: actions/checkout@v7
- name: Run task 'pack'
run: ./build.cmd pack
# Nothing in the solution consumes BenchmarkDotNet.TestAdapter as a package, so nothing else exercises the
# order in which NuGet imports its build files relative to Microsoft.Testing.Platform.MSBuild's.
- name: Smoke test the packed BenchmarkDotNet.TestAdapter
shell: pwsh
run: ./build/smoke-tests/test-adapter-consumer.ps1

spellcheck-docs:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions BenchmarkDotNet.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<Project Path="tests/BenchmarkDotNet.IntegrationTests.MonoBenchmarks/BenchmarkDotNet.IntegrationTests.MonoBenchmarks.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.SharedDiagnosers/BenchmarkDotNet.IntegrationTests.SharedDiagnosers.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.Static/BenchmarkDotNet.IntegrationTests.Static.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.TestingPlatform/BenchmarkDotNet.IntegrationTests.TestingPlatform.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.TestingPlatform.Failures/BenchmarkDotNet.IntegrationTests.TestingPlatform.Failures.csproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests.VisualBasic/BenchmarkDotNet.IntegrationTests.VisualBasic.vbproj" />
<Project Path="tests/BenchmarkDotNet.IntegrationTests/BenchmarkDotNet.IntegrationTests.csproj" />
<Project Path="tests/BenchmarkDotNet.Tests/BenchmarkDotNet.Tests.csproj" />
Expand Down
1 change: 1 addition & 0 deletions build/cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"vsprofiler",
"vstest",
"Tailcall",
"testadapter",
"toolchains",
"unmanaged"
],
Expand Down
22 changes: 22 additions & 0 deletions build/smoke-tests/TestAdapterConsumer/ConsumedBenchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Toolchains.InProcess.Emit;

namespace TestAdapterConsumer;

/// <summary>
/// A single benchmark, enough for the smoke test to check that the packaged adapter turns this project into a
/// Microsoft.Testing.Platform application that can list it.
/// </summary>
[Config(typeof(FastConfig))]
public class ConsumedBenchmark
{
[Benchmark]
public int Add() => 1 + 1;

private class FastConfig : ManualConfig
{
public FastConfig() => AddJob(Job.Dry.WithToolchain(InProcessEmitToolchain.Default));
}
}
26 changes: 26 additions & 0 deletions build/smoke-tests/TestAdapterConsumer/TestAdapterConsumer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<!--
Consumes BenchmarkDotNet.TestAdapter the way a real user does: as a NuGet package. That is the whole point of this
project, so it deliberately references nothing from this repository and is not part of BenchmarkDotNet.slnx - the
package it needs only exists after `build.cmd pack`, and an in-repo <Import> or ProjectReference would bring the
adapter's build files in before Microsoft.Testing.Platform.MSBuild's, which is the reverse of the packaged order.

Driven by build/smoke-tests/test-adapter-consumer.ps1.
-->

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!-- The nupkg is produced into the repository's artifacts folder by `build.cmd pack`. -->
<RestoreAdditionalProjectSources>$(MSBuildThisFileDirectory)..\..\..\artifacts</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup>
<!-- The version is passed in by the script, which reads it off the packed file name. -->
<PackageReference Include="BenchmarkDotNet.TestAdapter" Version="$(BenchmarkDotNetVersion)" />
</ItemGroup>

</Project>
115 changes: 115 additions & 0 deletions build/smoke-tests/test-adapter-consumer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env pwsh

<#
.SYNOPSIS
Smoke tests the packed BenchmarkDotNet.TestAdapter against a project that consumes it as a NuGet package.

.DESCRIPTION
Everything in this repository that uses the adapter's build files imports them by path from the project file,
which MSBuild evaluates before nuget.g.targets. A package consumer gets the opposite order: NuGet imports
Microsoft.Testing.Platform.MSBuild's targets, which default IsTestingPlatformApplication to true, and only then
the adapter's, which have to overwrite that default for the opt-outs to work. Nothing in the solution can
reproduce that order, so this restores the real package and asserts on how the properties resolve.

Run `build.cmd pack` first, so that the packages exist.

.PARAMETER ArtifactsDirectory
The directory `build.cmd pack` wrote the packages to.

.PARAMETER Configuration
The configuration to build the consuming project in.
#>

[CmdletBinding()]
param(
[string] $ArtifactsDirectory = [System.IO.Path]::Combine($PSScriptRoot, '..', '..', 'artifacts'),
[string] $Configuration = 'Release'
)

$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

$project = [System.IO.Path]::Combine($PSScriptRoot, 'TestAdapterConsumer', 'TestAdapterConsumer.csproj')
$targetFramework = 'net10.0'

# $IsWindows only exists on PowerShell Core, where it is the only way to tell; Windows PowerShell is Windows by definition.
$onWindows = ($null -eq $IsWindows) -or $IsWindows

# build.cmd installs the SDK the repository is pinned to into .dotnet, and only puts it on PATH for its own run.
$dotnet = [System.IO.Path]::Combine($PSScriptRoot, '..', '..', '.dotnet', $(if ($onWindows) { 'dotnet.exe' } else { 'dotnet' }))
if (-not (Test-Path $dotnet)) {
$dotnet = 'dotnet'
}

$package = Get-ChildItem -Path $ArtifactsDirectory -Filter 'BenchmarkDotNet.TestAdapter.*.nupkg' |
Where-Object { $_.Name -notlike '*.symbols.nupkg' } |
Select-Object -First 1

if ($null -eq $package) {
throw "No BenchmarkDotNet.TestAdapter package was found in '$ArtifactsDirectory'. Run 'build.cmd pack' first."
}

$version = $package.BaseName -replace '^BenchmarkDotNet\.TestAdapter\.', ''
Write-Output "Consuming BenchmarkDotNet.TestAdapter $version from $ArtifactsDirectory"

function Invoke-Dotnet {
param([Parameter(ValueFromRemainingArguments = $true)] [string[]] $Arguments)

$output = & $dotnet @Arguments 2>&1 | Out-String

if ($LASTEXITCODE -ne 0) {
Write-Output $output
throw "'dotnet $($Arguments -join ' ')' failed with exit code $LASTEXITCODE."
}

return $output
}

function Assert-Property {
param(
[string] $Name,
[string] $Expected,
[string[]] $With = @()
)

$arguments = @($project, '-nologo', '-tl:off', "-p:BenchmarkDotNetVersion=$version", "-p:Configuration=$Configuration") + $With + @("-getProperty:$Name")
$actual = (Invoke-Dotnet msbuild @arguments).Trim()

$description = if ($With.Count -eq 0) { 'by default' } else { "with $($With -join ' ')" }

if ($actual -ne $Expected) {
throw "Expected $Name to be '$Expected' $description, but it was '$actual'."
}

Write-Output " OK: $Name is '$Expected' $description"
}

Write-Output '##[group]Restoring the consuming project'
Invoke-Dotnet restore $project "-p:BenchmarkDotNetVersion=$version" '-tl:off' | Write-Output
Write-Output '##[endgroup]'

Write-Output 'Checking how the packaged build files resolve the test platform:'

# Microsoft.Testing.Platform is the default, and the adapter leaves the entry point to it.
Assert-Property -Name 'IsTestingPlatformApplication' -Expected 'true'
Assert-Property -Name 'GenerateProgramFile' -Expected 'false'

# The two opt-outs have to win over the default Microsoft.Testing.Platform.MSBuild sets in its own targets, which a
# package consumer imports before the adapter's.
Assert-Property -Name 'IsTestingPlatformApplication' -Expected 'false' -With '-p:BenchmarkDotNetUseVSTest=true'
Assert-Property -Name 'IsTestingPlatformApplication' -Expected 'false' -With '-p:GenerateProgramFile=false'

Write-Output '##[group]Building the consuming project'
Invoke-Dotnet build $project '--no-restore' '-c' $Configuration "-p:BenchmarkDotNetVersion=$version" '-tl:off' | Write-Output
Write-Output '##[endgroup]'

Write-Output 'Listing the benchmarks through the entry point Microsoft.Testing.Platform generated:'
$application = [System.IO.Path]::Combine($PSScriptRoot, 'TestAdapterConsumer', 'bin', $Configuration, $targetFramework, 'TestAdapterConsumer.dll')
$listed = Invoke-Dotnet $application '--list-tests' '--no-ansi'
Write-Output $listed

if ($listed -notmatch 'TestAdapterConsumer\.ConsumedBenchmark\.Add') {
throw 'The packaged adapter did not list the benchmark of the consuming project.'
}

Write-Output 'The packaged BenchmarkDotNet.TestAdapter behaves as expected.'
Loading