NAME
Context
SYNOPSIS
Provides logical grouping of It blocks within a single Describe block. Any Mocks definedinside a Context are removed at the end of the Context scope, as are any files or folders
added to the TestDrive during the Context block's execution. Any BeforeEach or AfterEach
blocks defined inside a Context also only apply to tests within that Context .
SYNTAX
Context [-Name]
[[-Fixture] ] [ ] DESCRIPTION
PARAMETERS
-Name
The name of the Context. This is a phrase describing a set of tests within a describe.
Required? true Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false-Fixture
Script that is executed. This may include setup specific to the context and one or more It blocks that validate the expected outcomes. Required? false Position? 2Default value $(Throw "No test script block is provided. (Have you put the open curly brace on
the next line?)") Accept pipeline input? false Accept wildcard characters? falseThis cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\>function Add-Numbers($a, $b) {
return $a + $b
}Describe "Add-Numbers" {
Context "when root does not exist" {
It "..." { ... } }Context "when root does exist" {
It "..." { ... } It "..." { ... } It "..." { ... } } }RELATED LINKS
Describe It BeforeEach AfterEach about_Should about_Mocking about_TestDrive