azure-sdk-tools/eng/common-tests
Ben Broderick Phillips 715cecc17b
Bump powershell yaml versions to 0.4.7 (#9326)
2024-11-20 15:33:42 -05:00
..
doc-automation/service-readme-generation
matrix-generator Remove default sub config sub-config-azure-cloud-test-resources (#9229) 2024-10-21 20:10:26 -07:00
psmodule-helpers Bump powershell yaml versions to 0.4.7 (#9326) 2024-11-20 15:33:42 -05:00
spelling Spelling: Remove deprecated --no-install, replace with --no (#9013) 2024-09-24 09:52:29 -07:00
README.md
ci.yml

README.md

About common-tests

Every PowerShell source that is complex enough to have unit tests should have these tests be written in the Pester framework and placed in eng/common-tests/**, i.e. this directory or one of its descendants.
By design, unlike eng/common, eng/common-tests is not subject to mirroring to repositories.

When tests in this directory are executed

The PowerShell Pester unit tests will be executed by the public tools - eng-common-tests pipeline upon a PR that makes changes to eng/common/scripts/** or eng/common-tests/**. The pipeline source is eng/common-tests/ci.yml.

In addition, specific tools might selectively run a subset of tests during their pipeline run, as e.g. done by tools/code-owners-parser/ci.yml.

How to ensure your PowerShell pester unit test is executed

By Pester's default convention, the tests are to be placed in files whose names ends with .tests.ps1, e.g. job-matrix-functions.tests.ps1.

Furthermore, each test needs to be tagged with UnitTest, e.g. as seen here: Describe "Matrix-Lookup" -Tag "UnitTest", "lookup".

Finally, as already mentioned, all such test files must be located in the path of eng/common-tests/**.

For more, see Invoke-Pester doc.