Are you ready to revolutionize your .NET testing workflow? If you’re an API developer, backend engineer, or QA specialist working with .NET, understanding the new Microsoft Testing Platform (MTP) is essential. This guide shows you how to harness MTP’s power in .NET 10 for faster, more flexible, and reliable testing—whether you’re building robust APIs or enterprise-scale applications.
💡 Want to generate developer-friendly API documentation and streamline your team’s API workflow? Discover how Apidog can help your team collaborate efficiently and replace Postman at a better price.
Why Solid Testing Matters in .NET
Testing is crucial for code quality and reliability—especially for API-driven or backend-heavy systems. Automated unit tests help you:
- Catch bugs early
- Refactor confidently
- Ensure code behaves as expected
With .NET 10’s performance improvements and MTP’s modern approach, you can integrate testing seamlessly into your CI/CD pipeline, speeding up feedback and deployment cycles.
What Is Microsoft Testing Platform (MTP)?
Microsoft Testing Platform (MTP), or MicrosoftTestingPlatform, is Microsoft’s next-generation testing framework, designed to replace the older VSTest runner. Unlike VSTest (which depends on adapters and DLL-based execution), MTP offers:
- A streamlined, native test running experience
- Standalone executable test runners
- Deep integration with
dotnet test - Support for MSTest, NUnit, and xUnit
- Enhanced performance, especially in .NET 10 environments
MTP is built for modern development—ideal for cross-platform, CI/CD, and large-scale API projects.
Step-by-Step: Using MTP and MSTest in .NET 10
1. Create a Basic MSTest Project
Scaffold your test project:
dotnet new mstest -n MyMtpTests
This sets up a folder MyMtpTests with default test files.
Review the project file (MyMtpTests.csproj):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
</ItemGroup>
</Project>
This is the standard MSTest + VSTest configuration. You can run tests using:
cd MyMtpTests
dotnet test
Why start here? This baseline lets you compare the traditional VSTest experience with MTP’s new capabilities.
2. Upgrade to MTP Executable Test Runner
Switching to MTP’s executable mode gives you more flexibility—perfect for CI/CD pipelines or running tests without the full .NET SDK.
Update your .csproj to enable MTP:
<PropertyGroup>
<EnableMSTestRunner>true</EnableMSTestRunner>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<OutputType>Exe</OutputType>
...
</PropertyGroup>
EnableMSTestRunner: Activates MTP.TestingPlatformDotnetTestSupport: Ensuresdotnet testcompatibility.OutputType: Outputs an executable instead of a DLL.
Build and run:
dotnet build
cd bin/Debug/net8.0
# Windows
MyMtpTests.exe
# macOS/Linux
./MyMtpTests


Benefits:
- Run tests as standalone apps—no
dotnet testrequired - Easier integration into custom build systems or containers
- Faster execution by eliminating VSTest overhead
3. Real-World Example: Multi-Project Testing with .NET 10 and MTP
A typical API or backend solution has multiple projects. Here’s how to structure and test them with MTP:
Project Structure:
MyMtpSolution/
├── MyLibrary/
│ └── Calculator.cs
├── MyLibrary.Tests/
│ └── CalculatorTests.cs
├── MyMtpSolution.sln
└── dotnet.config
a) Create the solution and projects:
dotnet new sln -n MyMtpSolution
dotnet new classlib -n MyLibrary
dotnet new mstest -n MyLibrary.Tests
b) Implement your code (e.g., Calculator.cs):
namespace MyLibrary
{
public class Calculator
{
public int Add(int a, int b) => a + b;
public int Subtract(int a, int b) => a - b;
public int Multiply(int a, int b) => a * b;
public int Divide(int a, int b) =>
b == 0 ? throw new ArgumentException("Cannot divide by zero.") : a / b;
}
}
c) Write tests (CalculatorTests.cs):
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MyLibrary;
namespace MyLibrary.Tests
{
[TestClass]
public class CalculatorTests
{
private Calculator _calculator;
[TestInitialize]
public void Setup() => _calculator = new Calculator();
[TestMethod]
public void Add_ReturnsCorrectSum() =>
Assert.AreEqual(5, _calculator.Add(2, 3));
[TestMethod]
public void Subtract_ReturnsCorrectDifference() =>
Assert.AreEqual(1, _calculator.Subtract(3, 2));
[TestMethod]
public void Multiply_ReturnsCorrectProduct() =>
Assert.AreEqual(6, _calculator.Multiply(2, 3));
[TestMethod]
public void Divide_ReturnsCorrectQuotient() =>
Assert.AreEqual(2, _calculator.Divide(6, 3));
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Divide_ByZero_ThrowsException() =>
_calculator.Divide(6, 0);
}
}
d) Link projects:
dotnet add MyLibrary.Tests reference MyLibrary
dotnet sln MyMtpSolution.sln add MyLibrary/MyLibrary.csproj
dotnet sln MyMtpSolution.sln add MyLibrary.Tests/MyLibrary.Tests.csproj
e) Enable MTP and .NET 10:
- Update
MyLibrary.Tests.csproj:
<TargetFramework>net10.0</TargetFramework>
<EnableMSTestRunner>true</EnableMSTestRunner>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
- Create
dotnet.configin the solution root:
[dotnet.test.runner]
name = "Microsoft.Testing.Platform"
- Ensure you’ve installed the .NET 10 SDK.

f) Run your tests:
dotnet test
Now you’re running tests using MTP on .NET 10, with improved speed and reliability.

Key Advantages: MTP + .NET 10
- Performance: Native runner reduces test startup time and leverages .NET 10’s optimizations (like better JIT and memory management).
- Flexibility: Standalone test executables fit seamlessly into custom CI/CD and containerized workflows.
- Scalability: Handles multi-project solutions with ease.
- Modern Features: Supports parallel test execution, advanced reporters, and integrates tightly with the latest .NET ecosystem.
User feedback:
“It’s like VSTest but without the baggage—faster and cleaner!”
With MTP and .NET 10, runningdotnet testbecomes a developer-friendly experience.
Troubleshooting MTP and .NET 10 Testing
-
Tests not running?
- Check that the .NET 10 SDK is installed.
- Ensure
<TargetFramework>net10.0</TargetFramework>is set.
-
MTP not enabled?
- Confirm
<EnableMSTestRunner>and<TestingPlatformDotnetTestSupport>are in your.csprojordotnet.config.
- Confirm
-
Missing coverage reports?
- Add
coverlet.collectorand run:dotnet test --collect:"XPlat Code Coverage"
- Add
-
Executable fails?
- Confirm
<OutputType>Exe</OutputType>is set and rebuild before running the.exe.
- Confirm
Conclusion: Modernize Your .NET Testing Workflow
By adopting Microsoft Testing Platform with .NET 10, you’ll gain faster, more reliable, and more flexible testing—crucial for API development, backend systems, and quality assurance. Build on these steps to expand your tests, integrate into CI/CD, or explore advanced MTP features.
If your team values seamless API collaboration, Apidog’s integrated platform supports everything from test automation to beautiful API documentation—all while keeping your workflow efficient and cost-effective.



