GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Updated Pester Syntax in Writing Tests Guide by markwragg · Pull Request #8039 · PowerShell/PowerShell

Conversation

@markwragg

@markwragg Mark Wragg (markwragg) commented Oct 15, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR Summary

  • Modified the Pester syntax for the -Be assertion (instead of just Be) to reflect the preferred use per latest version of Pester.
  • Added an example showing use of -BeOfType to test the type of a variable.
  • Other minor changes for grammar.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • User-facing Documentation needed
      • Issue filed - Issue link:
  • Testing - New and feature
    • Not Applicable or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mark Wragg (markwragg) added 2 commits October 15, 2018 22:22
@markwragg
Update to WritingPesterTests.md
9d23d5c
- Modified the Pester syntax for the `-Be` assertion (instead of just `Be`) to reflect the preferred use per latest version of Pester.
- Added an example showing use of `-BeOfType` to test the type of a variable.
- Other minor changes for grammar.
@markwragg
Merge pull request #1 from markwragg/markwragg-patch-1
80ac38c
Update to WritingPesterTests.md
iSazonov
Ilya (iSazonov) reviewed Oct 16, 2018
View reviewed changes
Comment thread docs/testing-guidelines/WritingPesterTests.md Outdated

#### Describe
Creates a logical group of tests. All Mocks and TestDrive contents defined within a Describe block are scoped to that Describe; they will no longer be present when the Describe block exits. A `Describe block may contain any number of Context and It blocks.
Creates a logical group of tests. All Mocks and TestDrive contents defined within a Describe block are scoped to that Describe; they will no longer be present when the Describe block exits. A Describe block may contain any number of Context and It blocks.

@iSazonov Ilya (iSazonov) Oct 16, 2018

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be - A `Describe` block

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docs/testing-guidelines/WritingPesterTests.md Outdated

The DESCRIBE BeforeAll block is executed before any other code even though it was at the bottom of the Describe block, so if state is set elsewhere in the describe BLOCK, that state will not be visible (as the code will not yet been run). Notice, too, that the BEFOREALL block in Context is executed before any other code in that block.
Generally, you should have code reside in one of the code block elements of `[Before|After][All|Each]`, especially if those block rely on state set by free code elsewhere in the block.
The Describe BeforeAll block is executed before any other code even though it was at the bottom of the Describe block, so if state is set elsewhere in the describe BLOCK, that state will not be visible (as the code will not yet been run). Notice, too, that the BeforeAll block in Context is executed before any other code in that block.

@iSazonov Ilya (iSazonov) Oct 16, 2018

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`Describe` `BeforeAll`
BLOCK -> block

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@markwragg
Update WritingPesterTests.md
148c340
@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) requested a review from James Truher (JamesWTruher) October 18, 2018 19:15
TravisEz13
Travis Plunk (TravisEz13) requested changes Oct 19, 2018
View reviewed changes
Comment thread docs/testing-guidelines/WritingPesterTests.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/testing-guidelines/WritingPesterTests.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/testing-guidelines/WritingPesterTests.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/testing-guidelines/WritingPesterTests.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TravisEz13

Travis Plunk (TravisEz13) commented Oct 19, 2018

Copy link
Copy Markdown
Member

You also have spelling issues. I filed the following issue on the spelling tests: #8078

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Travis Plunk (TravisEz13) and others added 3 commits October 19, 2018 08:44
@TravisEz13 @markwragg
Update docs/testing-guidelines/WritingPesterTests.md
feb5896
Co-Authored-By: markwragg <[email protected]>
@TravisEz13 @markwragg
Update docs/testing-guidelines/WritingPesterTests.md
e7462c6
Co-Authored-By: markwragg <[email protected]>
@TravisEz13 @markwragg
Update docs/testing-guidelines/WritingPesterTests.md
20a5c93
Co-Authored-By: markwragg <[email protected]>
@iSazonov Ilya (iSazonov) assigned Travis Plunk (TravisEz13) Oct 19, 2018
@TravisEz13

Travis Plunk (TravisEz13) commented Oct 20, 2018

Copy link
Copy Markdown
Member

The PR is still failing the spelling check. FYI, I'm out of the office for the next week and will be checking GitHub less frequently.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markwragg

Mark Wragg (markwragg) commented Oct 22, 2018

Copy link
Copy Markdown
Contributor Author

It's hard to tell from the spelling test output which specific words it's failing on, but to me it looks like in each case it's Pester domain-specific words like AfterEach and BeforeEach. The page doesn't currently mark each of these as inline code (that was true before my improvements) and I don't know if doing so would make them excluded from the spelling check and/or is necessary/desirable.

I'm pretty sure this PR has not introduced any new spelling mistakes, and I think it is an improvement on the previous version of this page, so my suggestion would be to merge it and iterate with further versions for other improvements.

If you can provide more specifics on spellings that you want edited however I'm happy to implement.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 23, 2018

Copy link
Copy Markdown
Collaborator

Mark Wragg (@markwragg) Please replace ' with backstick. It'll resolve all issues.
BeforeEach -> `BeforeEach`

'RequireAdminOnWindows' -> `RequireAdminOnWindows`

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mark Wragg (markwragg) added 2 commits October 23, 2018 13:41
@markwragg
Update WritingPesterTests.md
1961960
@markwragg
Update WritingPesterTests.md
01b372a
iSazonov
Ilya (iSazonov) approved these changes Oct 23, 2018
View reviewed changes
@markwragg
Update WritingPesterTests.md
b23e300
JamesWTruher
James Truher (JamesWTruher) previously requested changes Oct 25, 2018
View reviewed changes

@JamesWTruher James Truher (JamesWTruher) left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple things, but important (i think)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docs/testing-guidelines/WritingPesterTests.md
It "1 is really an int" {
$i = 1
$i.GetType() | Should Be "int"
$i.GetType() | Should -BeExactly "int"

@JamesWTruher James Truher (JamesWTruher) Oct 25, 2018

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should really be:
$i | Should -BeOfType [int]
and consistent with the next change

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markwragg Mark Wragg (markwragg) Oct 26, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this then makes this example a duplicate of the one that follows it. Should we just remove this example instead of we don't want to recommend checking types this way?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docs/testing-guidelines/WritingPesterTests.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/testing-guidelines/WritingPesterTests.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@markwragg
Update WritingPesterTests.md
b863f39
TravisEz13
Travis Plunk (TravisEz13) approved these changes Oct 29, 2018
View reviewed changes
@TravisEz13

Travis Plunk (TravisEz13) commented Oct 29, 2018

Copy link
Copy Markdown
Member

restarted macOS CI

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TravisEz13
Travis Plunk (TravisEz13) dismissed James Truher (JamesWTruher)’s stale review October 30, 2018 00:48

review is out of date

@TravisEz13
Travis Plunk (TravisEz13) merged commit 8215914 into PowerShell:master Oct 30, 2018
@iSazonov

Ilya (iSazonov) commented Oct 30, 2018

Copy link
Copy Markdown
Collaborator

Mark Wragg (@markwragg) Thanks for your contribution!

TravisEz13 reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@markwragg @TravisEz13
Updated Pester Syntax in Writing Tests Guide (PowerShell#8039)
eb0af14
- Modified the Pester syntax for the `-Be` assertion (instead of just `Be`) to reflect the preferred use per latest version of Pester.
- Added an example showing use of `-BeOfType` to test the type of a variable.
- Other minor changes for grammar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@TravisEz13 Travis Plunk (TravisEz13) TravisEz13 approved these changes
@iSazonov Ilya (iSazonov) iSazonov approved these changes
+1 more reviewer
@JamesWTruher James Truher (JamesWTruher) JamesWTruher left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@TravisEz13 Travis Plunk (TravisEz13)

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@markwragg @TravisEz13 @iSazonov @JamesWTruher
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.