8000 Corect xUnit heading and other MD linting warnings (#3272) · SeeminglyScience/PowerShell@302b520 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 302b520

Browse files
KevinMarquetteTravisEz13
authored andcommitted
Corect xUnit heading and other MD linting warnings (PowerShell#3272)
1 parent dd0fbd6 commit 302b520

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

docs/testing-guidelines/testing-guidelines.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ These green check boxes and red crosses are **clickable** as well.
4949
They will bring you to the corresponding page with details.
5050

5151
## Test Frameworks
52+
5253
### Pester
54+
5355
Our script-based test framework is [Pester](https://github.com/Pester/Pester).
5456
This is the framework which we are using internally at Microsoft for new script-based tests,
5557
and a large number of the tests which are part of the PowerShell project have been migrated from that test base.
@@ -59,45 +61,60 @@ Substantial changes were required, to get Pester executing on non-Windows system
5961
These changes are not yet in the o 8000 fficial Pester code base.
6062
Some features of Pester may not be available or may have incorrect behavior.
6163
Please make sure to create issues in [PowerShell/PowerShell](https://github.com/PowerShell/PowerShell/issues) (not Pester) for anything that you find.
64+
6265
#### Test Tags
66+
6367
The Pester framework allows `Describe` blocks to be tagged, and our CI system relies on those tags to invoke our tests.
68+
6469
One of the following tags must be used:
70+
6571
* `CI` - this tag indicates that the tests in the `Describe` block will be executed as part of the CI/PR process
66-
* `Feature` - tests with this tag will not be executed as part of the CI/PR process, but they will be executed on a daily basis as part of a `cron` driven build
67-
They indicate that the test will be validating more behavior, or will be using remote network resources (ex: package management tests)
72+
* `Feature` - tests with this tag will not be executed as part of the CI/PR process, but they will be executed on a daily basis as part of a `cron` driven build. They indicate that the test will be validating more behavior, or will be using remote network resources (ex: package management tests)
6873
* `Scenario` - this tag indicates a larger scale test interacting with multiple areas of functionality and/or remote resources, these tests are also run daily.
6974

7075
Additionally, the tag:
76+
7177
* `SLOW` indicates that the test takes a somewhat longer time to execute (97% of our `CI` tests take 100ms or less), a test which takes longer than 1 second should be considered as a candidate for being tagged `Slow`
78+
7279
### xUnit
80+
7381
For those tests which are not easily run via Pester, we have decided to use [xUnit](https://xunit.github.io/) as the test framework.
7482
Currently, we have a minuscule number of tests which are run by using xUnit.
7583

7684
## Running tests outside of CI
85+
7786
When working on new features or fixes, it is natural to want to run those tests locally before making a PR.
7887
Two helper functions are part of the build.psm1 module to help with that:
88+
7989
* `Start-PSPester` will execute all Pester tests which are run by the CI system
8090
* `Start-PSxUnit` will execute the available xUnit tests run by the CI system
91+
8192
Our CI system runs these as well; there should be no difference between running these on your dev system, versus in CI.
8293

8394
When running tests in this way, be sure that you have started PowerShell with `-noprofile` as some tests will fail if the
8495
environment is not the default or has any customization.
8596

8697
For example, to run all the Pester tests for CI (assuming you are at the root of the PowerShell repo):
98+
8799
```
88100
Import-Module ./build.psm1
89101
Start-PSPester
90102
```
103+
91104
If you wish to run specific tests, that is possible as well:
105+
92106
```
93107
Start-PSPester -Path test/powershell/engine/Api
94108
```
109+
95110
Or a specific Pester test file:
111+
96112
```
97113
Start-PSPester -Path test/powershell/engine/Api/XmlAdapter.Tests.ps1
98114
```
99115

100116
### What happens after your PR?
117+
101118
When your PR has successfully passed the CI test gates, your changes will be used to create PowerShell binaries which can be run
102119
in Microsoft's internal test frameworks.
103120
The tests that you created for your change and the library of historical tests will be run to determine if any regressions are present.
@@ -106,10 +123,13 @@ If these tests find regressions, you'll be notified that your PR is not ready, a
106123

107124

108125
## Test Layout
126+
109127
We have taken a functional approach to the layout of our Pester tests and you should place new tests in their appropriate location.
110128
If you are making a fix to a cmdlet in a module, the test belongs in the module directory.
111129
If you are unsure, you can make it part of your PR, or create an issue.
130+
112131
The current layout of tests is:
132+
113133
* test/powershell/engine
114134
* test/powershell/engine/Api
115135
* test/powershell/engine/Basic
@@ -144,4 +164,3 @@ The current layout of tests is:
144164
* test/powershell/Modules/Microsoft.PowerShell.Security
145165
* test/powershell/Modules/Microsoft.PowerShell.Utility
146166
* test/powershell/Modules/PSReadLine
147-

0 commit comments

Comments
 (0)
0