715cecc17b | ||
---|---|---|
.. | ||
doc-automation/service-readme-generation | ||
matrix-generator | ||
psmodule-helpers | ||
spelling | ||
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.