Defines a series of steps to perform at the beginning of the current container, Context or Describe block.
BeforeAll is used to share setup among all the tests in a container, Describe or Context including all child blocks and tests. BeforeAll runs during Run phase and runs only once in the current level.
The typical usage is to setup the whole test script, most commonly to import the tested function, by dot-sourcing the script file that contains it.
BeforeAll and AfterAll are unique in that they apply to the entire container, Context or Describe block regardless of the order of the statements compared to other Context or Describe blcoks at the same level.
This example uses dot-sourcing in BeforeAll to make functions in the script-file available for the tests.
This example uses BeforeAll to perform an expensive operation only once, before validating the results in separate tests.
A scriptblock with steps to be executed during setup.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This page was auto-generated using the comment based help in Pester 5.1.1. To edit the content of this page, change the corresponding help in the pester/Pester repository. See our contribution guide for more information.