You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make the experience better when start-pspester doesn't find pester (#5673)
refactor code to restore pester into a separate function called Restore-PSPester
update message on what to do when pester is missing
Add ability for get-psoptions to default to new-psoptions
fix an issue with publish-pstesttools when a build has not been run since build.psm1 has been imported (try to use the default options)
make start-pspester use the last build, not just use the default options
fix an issue in restore caused some files not to be removed
Copy file name to clipboardExpand all lines: docs/testing-guidelines/testing-guidelines.md
+10-15Lines changed: 10 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
2
1
# Testing Guidelines
3
2
4
3
Testing is a critical and required part of the PowerShell project.
5
4
6
5
The Microsoft PowerShell team created nearly 100,000 tests over the last 12 years which we run as part of the release process for Windows PowerShell.
7
-
Having all of those tests available for the initial release of PowerShell was not feasible, and we have targeted those tests which we believe will provide us the ability to catch regressions in the areas which have had the largest changes for PowerShell.
6
+
Having all of those tests available for the initial release of PowerShell was not feasible,
7
+
and we have targeted those tests which we believe will provide us the ability to catch regressions in the areas which have had the largest changes for PowerShell.
8
8
It is our intent to continue to release more and more of our tests until we have the coverage we need.
9
9
10
10
For creating new tests, please review the [documents](https://github.com/PowerShell/PowerShell/tree/master/docs/testing-guidelines) on how to create tests for PowerShell.
@@ -69,7 +69,8 @@ The Pester framework allows `Describe` blocks to be tagged, and our CI system re
69
69
One of the following tags must be used:
70
70
71
71
*`CI` - this tag indicates that the tests in the `Describe` block will be executed as part of the CI/PR process
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)
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.
73
+
They indicate that the test will be validating more behavior, or will be using remote network resources (ex: package management tests)
73
74
*`Scenario` - this tag indicates a larger scale test interacting with multiple areas of functionality and/or remote resources, these tests are also run daily.
74
75
75
76
Additionally, the tag:
@@ -105,39 +106,35 @@ Currently, we have a minuscule number of tests which are run by using xUnit.
105
106
## Running tests outside of CI
106
107
107
108
When working on new features or fixes, it is natural to want to run those tests locally before making a PR.
108
-
Two helper functions are part of the build.psm1 module to help with that:
109
+
Three helper functions are part of the build.psm1 module to help with that:
109
110
111
+
*`Restore-PSPester` will restore Pester, which is needed to run `Start-PSPester`
110
112
*`Start-PSPester` will execute all Pester tests which are run by the CI system
111
113
*`Start-PSxUnit` will execute the available xUnit tests run by the CI system
112
114
113
115
Our CI system runs these as well; there should be no difference between running these on your dev system, versus in CI.
114
116
115
-
Make sure that the git submodules have been loaded into your project before running `Start-PSPester`, or it will fail to run.
116
-
If you did not clone the project with the `--recursive` flag, you can load the submodules by running:
117
-
118
-
```
119
-
git submodule update --init
120
-
```
117
+
Make sure that you run `Restore-PSPester` before running `Start-PSPester`, or it will fail to run.
121
118
122
119
When running tests in this way, be sure that you have started PowerShell with `-noprofile` as some tests will fail if the
123
120
environment is not the default or has any customization.
124
121
125
122
For example, to run all the Pester tests for CI (assuming you are at the root of the PowerShell repo):
126
123
127
-
```
124
+
```PowerShell
128
125
Import-Module ./build.psm1
129
126
Start-PSPester
130
127
```
131
128
132
129
If you wish to run specific tests, that is possible as well:
@@ -148,8 +145,6 @@ in Microsoft's internal test frameworks.
148
145
The tests that you created for your change and the library of historical tests will be run to determine if any regressions are present.
149
146
If these tests find regressions, you'll be notified that your PR is not ready, and provided with enough information to investigate why the failure happened.
150
147
151
-
152
-
153
148
## Test Layout
154
149
155
150
We have taken a functional approach to the layout of our Pester tests and you should place new tests in their appropriate location.
0 commit comments