Validates the results of a test inside of a Describe block.
The It command is intended to be used inside of a Describe or Context Block. If you are familiar with the AAA pattern (Arrange-Act-Assert), the body of the It block is the appropriate location for an assert. The convention is to assert a single expectation for each It block. The code inside of the It block should throw a terminating error if the expectation of the test is not met and thus cause the test to fail. The name of the It block should expressively state the expectation of the test.
In addition to using your own logic to test expectations and throw exceptions, you may also use Pester's Should command to perform assertions in plain language.
You can intentionally mark It block result as inconclusive by using Set-TestInconclusive command as the first tested statement in the It block.
An expressive phrase describing the expected test outcome.
The script block that should throw an exception if the expectation of the test is not met.If you are following the AAA pattern (Arrange-Act-Assert), this typically holds the Assert.
Optional array of hashtable (or any IDictionary) objects. If this parameter is used, Pester will call the test script block once for each table in the TestCases array, splatting the dictionary to the test script block as input. If you want the name of the test to appear differently for each test case, you can embed tokens into the Name parameter with the syntax 'Adds numbers \<A> and \<B>' (assuming you have keys named A and B in your TestCases hashtables.)
Use this parameter to explicitly mark the test as work-in-progress/not implemented/pending when you need to distinguish a test that fails because it is not finished yet from a tests that fail as a result of changes being made in the code base. An empty test, that is a test that contains nothing except whitespace or comments is marked as Pending by default.
Use this parameter to explicitly mark the test to be skipped. This is preferable to temporarily commenting out a test, because the test remains listed in the output. Use the Strict parameter of Invoke-Pester to force all skipped tests to fail.
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 Pester's comment based help. To edit the content of this page, change the corresponding help in the pester/Pester repository. See our contribution guide for more information.