Skip to content

Feature/testing environment#6996

Open
nandhakumar1980 wants to merge 2 commits into
Microsoft365DSC:Devfrom
nandhakumar1980:feature/testing-environment
Open

Feature/testing environment#6996
nandhakumar1980 wants to merge 2 commits into
Microsoft365DSC:Devfrom
nandhakumar1980:feature/testing-environment

Conversation

@nandhakumar1980
Copy link
Copy Markdown

@nandhakumar1980 nandhakumar1980 commented Mar 25, 2026

Description

This PR introduces incremental improvements to the existing testing setup while preserving the current structure and workflow.

The focus is on improving maintainability, organization, and test execution without introducing disruptive or large-scale changes.

Changes

  • Refactored parts of the test structure for improved readability and consistency
  • Improved organization of existing test files
  • Extracted helper functions for resource authentication and tenant cleanup
  • Added a local integration testing module (M365DSCDeploymentTestEngine.psm1) to support test execution
  • Introduced a GitHub Actions workflow to automate test runs

Why this change?

A previous proposal introduced a broader testing overhaul, which may be difficult to review and integrate in a single step. This PR instead focuses on smaller, self-contained improvements that align with the current setup.

Benefits

  • Easier to review and integrate
  • Improves maintainability and clarity of tests
  • Adds a foundation for future enhancements without disrupting existing functionality

Notes

These changes are intended to be incremental. Additional improvements can be proposed in follow-up PRs if needed.
-->

  • Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
    Entry should say what was changed and how that affects users (if applicable), and
    reference the issue being resolved (if applicable).
  • Resource parameter descriptions added/updated in the schema.mof.
  • Resource documentation added/updated in README.md.
  • Resource settings.json file contains all required permissions.
  • Examples appropriately added/updated.
  • Unit tests added/updated.
  • New/changed code adheres to DSC Community Style Guidelines.

- M365DSCDeploymentTestEngine.psm1: Core engine that deploys each resource,
  exports tenant state, and uses Assert-M365DSCBlueprint for drift detection
- Supports all auth methods (Credential, Certificate, AppSecret, ManagedIdentity, AccessTokens)
- Auto-detects supported auth methods per resource from schema MOF files
- Config/TestTenants.config.json: Tenant config with env var placeholders for secrets
- Config/KnownIssues.json: Registry of resources with known deployment issues
- Helpers/Get-ResourceAuthMethods.ps1: Auth method discovery utility
- Helpers/New-TestReport.ps1: HTML/JSON report generator
- Helpers/Invoke-TenantCleanup.ps1: Tenant reset utility
- GitHub Actions workflows for per-workload and all-workload deployment testing
- README.md with full documentation and usage examples
@nandhakumar1980
Copy link
Copy Markdown
Author

microsoft-github-policy-service @microsoft-github-policy-service agree

@nandhakumar1980
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@FabienTschanz
Copy link
Copy Markdown
Collaborator

@nandhakumar1980 Thank you for the PR. The proposed testing environment is a change too big to handle right now since we already have a couple of tests running at the moment, but we'll leave it open and adapt certain aspects of it into our testing to improve the quality of the product. Appreciate it.

@ricmestre
Copy link
Copy Markdown
Contributor

@FabienTschanz This is what I've been doing for years, but I use my own code. I could still share with you privately all the blueprints I've carefully created manually, I shared them with Nik a long time ago also but the current pipelines here in GH already started this work but actually don't work because they use credentials and without MFA they don't work, my blueprints on the other hand use certificates (where I use my own variables instead of relying on ConfigurationData).

@FabienTschanz
Copy link
Copy Markdown
Collaborator

@ricmestre I'm aware of that fact. I'd first like to implement some changes here to target my own lab tenant for this, and once that is done, I can start with implementing more examples. I'll message you privately for some information when I get to the point where I need them. Thanks.

@nandhakumar1980
Copy link
Copy Markdown
Author

@FabienTschanz Thanks for the feedback! That makes sense.

Would you prefer if I break this into smaller PRs or focus on specific parts that align with your current testing setup? Happy to adjust based on what works best for the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants