-
Notifications
You must be signed in to change notification settings - Fork 189
Guideline for ARM Support Resource Plugin’s Unit Test E2E Test
This is the guideline for resource plugin owners to contribute unit tests / end-to-end tests.
Unit test path: packages\fx-core\tests\plugins\resource<myResroucePluginName>\unit\xxx.test.ts
Walk through the plugin.generateArmTemplates()
API to check detailed logic that needs being tested.
-
Should generate ARM templates successfully
- Arrange: Leverage testHelper’s method to mock plugin context.
- Act: Execute
plugin.generateArmTemplates()
API. - Assert: Utilizing
mockSolutionUpdateArmTemplates()
in packages\fx-core\tests\plugins\resource\util.ts to compile the return result. Verify that the ARM templates result compiled by solution mocked function is correct: expected properties are correct, undefined properties are undefined.
-
Should generate ARM templates successfully in other scenarios.
Add test cases when the ARM templates generation logic differs when includes different cloud resources / capabilities. (E.g., The project is a SPFx project / tab project / bot project / tab+bot project / tab+bot+messagingExtension project, etc.)
-
Should fail / throw error if xxx requirement is not met (e.g., some value does not exist in context)
-
Should update ARM templates successfully
- Arrange: Leverage testHelper’s method to mock plugin context.
- Act: Execute
plugin.updateArmTemplates()
API. - Assert: Utilizing
mockSolutionUpdateArmTemplates()
in packages\fx-core\tests\plugins\resource\util.ts to compile the return result. Verify that the ARM templates result compiled by solution mocked function is correct: expected properties are correct, undefined properties are undefined.
-
Should update ARM templates successfully in other scenarios.
Add test cases when the ARM templates generation logic differs when includes different cloud resources / capabilities. (E.g., The project is a SPFx project / tab project / bot project / tab+bot project / tab+bot+messagingExtension project, etc.)
-
Should fail / throw error if xxx requirement is not met (e.g., some value does not exist in context)
E2E test path: packages\cli\tests\e2e<myResroucePluginName>\xxx.tests.ts. (E2E test file must end with .tests.ts.)
-
Create project with the plugin can generate ARM template / provision / deploy successfully
-
Azure resource can be deployed to customized resource group
-
Add resource /capability should work successfully: Resource plugin bicep files generation will differ when project has different active plugins. Add E2E test to test the generated bicep files and the provision result when with different plugins in the project.
For example, function resource plugin has the following template config bicep file:
// packages\fx-core\templates\plugins\resource\function\bicep\functionConfiguration.template.bicep {{#if (contains "fx-resource-key-vault" plugins)}} var m365ClientSecret = \{{fx-resource-key-vault.References.m365ClientSecretReference}} {{else}} var m365ClientSecret = provisionParameters['m365ClientSecret'] {{/if}} resource appSettings 'Microsoft.Web/sites/config@2021-02-01' = { name: '${functionAppName}/appsettings' properties: union({ ... M365_CLIENT_SECRET: m365ClientSecret // Client secret of Microsoft Entra application ... }, currentAppSettings) // Merge new settings with existing settings }
When with keyvault plugin, function resource plugin config bicep file will set the m365ClientSecret as keyvault reference and set into function app settings. So function plugin owner add an E2E test TabAdFunctionKeyvault.tests.ts to test that a tab + function + keyvault project can successfully scaffolded and provisioned. After provision, function app setting will have m365 client secret as a key vault reference.
Build Custom Engine Copilots
- Build a basic AI chatbot for Teams
- Build an AI agent chatbot for Teams
- Expand AI bot's knowledge with your content
Scenario-based Tutorials
- Send notifications to Teams
- Respond to chat commands in Teams
- Respond to card actions in Teams
- Embed a dashboard canvas in Teams
Extend your app across Microsoft 365
- Teams tabs in Microsoft 365 and Outlook
- Teams message extension for Outlook
- Add Outlook Add-in to a Teams app
App settings and Microsoft Entra Apps
- Manage Application settings with Teams Toolkit
- Manage Microsoft Entra Application Registration with Teams Toolkit
- Use an existing Microsoft Entra app
- Use a multi-tenant Microsoft Entra app
Configure multiple capabilities
- How to configure Tab capability within your Teams app
- How to configure Bot capability within your Teams app
- How to configure Message Extension capability within your Teams app
Add Authentication to your app
- How to add single sign on in Teams Toolkit for Visual Studio Code
- How to enable Single Sign-on in Teams Toolkit for Visual Studio
Connect to cloud resources
- How to integrate Azure Functions with your Teams app
- How to integrate Azure API Management
- Integrate with Azure SQL Database
- Integrate with Azure Key Vault
Deploy apps to production