Microsoft.Learn.AzureFunctionsTesting.Core
1.2.0
Prefix Reserved
dotnet add package Microsoft.Learn.AzureFunctionsTesting.Core --version 1.2.0
NuGet\Install-Package Microsoft.Learn.AzureFunctionsTesting.Core -Version 1.2.0
<PackageReference Include="Microsoft.Learn.AzureFunctionsTesting.Core" Version="1.2.0" />
<PackageVersion Include="Microsoft.Learn.AzureFunctionsTesting.Core" Version="1.2.0" />
<PackageReference Include="Microsoft.Learn.AzureFunctionsTesting.Core" />
paket add Microsoft.Learn.AzureFunctionsTesting.Core --version 1.2.0
#r "nuget: Microsoft.Learn.AzureFunctionsTesting.Core, 1.2.0"
#:package Microsoft.Learn.AzureFunctionsTesting.Core@1.2.0
#addin nuget:?package=Microsoft.Learn.AzureFunctionsTesting.Core&version=1.2.0
#tool nuget:?package=Microsoft.Learn.AzureFunctionsTesting.Core&version=1.2.0
Microsoft.Learn.AzureFunctionsTesting.Core
This package contains the core interfaces used by extension authors to create plugins for the testing system.
Creating a extension
There are three steps to creating an extension:
- Create a class that implements
IFunctionTestPlugin - Create an extension method for
IFunctionTestConfigurationBuilderwhere you register your plugin - [Optional] Create an extension method for
IFunctionFixturethat lets you access the plugin from tests
Creating the plugin
The InitializeAsync() method will get called once when the test run starts and you should use it to do any test suite setup.
The DisposeAsync() method will get called once when the test run completes and you can use it ot do any test suite teardown.
You can expose a property (ex: CosmosClient, Database, etc) that you can get back to from individual tests to do any per-test setup.
Registering your plugin
Create an extension method on IFunctionTestConfigurationBuilder. You must call builder.RegisterPlugin() in order for your plugin to get called by the test runtime.
You can also optionally register any environment variables which will get converted into IConfiguration values that can be accessed from your function app.
Use your plugin in tests
Create an extension method on IFunctionFixture and call fixture.GetPlugin() to get a reference to your plugin. Use the same name you used when registering the plugin.
You can access the custom property on your plugin to do per-test arrangement (inserting database records, etc).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Microsoft.Learn.AzureFunctionsTesting.Core:
| Package | Downloads |
|---|---|
|
Microsoft.Learn.AzureFunctionsTesting
This library provides a helpful framework that allows you to test your Azure Functions Http Triggers in a manner similar to how ASP.NET Core integration testing works. |
|
|
Microsoft.Learn.AzureFunctionsTesting.Extension.DebugProcess
An extension for the Microsoft.Learn.AzureFunctionsTesting framework to allow stepping into debugged tests across processes. |
|
|
Microsoft.Learn.AzureFunctionsTesting.Extension.MockHttpServer
An extension for the Microsoft.Learn.AzureFunctionsTesting framework to allow mocking any HTTP server. |
|
|
Microsoft.Learn.AzureFunctionsTesting.Extension.MockCosmos
An extension for the Microsoft.Learn.AzureFunctionsTesting framework to allow mocking Cosmos DB. |
|
|
Microsoft.Learn.AzureFunctionsTesting.Extension.MockSql
An extension for the Microsoft.Learn.AzureFunctionsTesting framework to allow mocking SQL Server DBs. |
GitHub repositories
This package is not used by any popular GitHub repositories.