![]() In our example we used it to define the tested function. To do this we BeforeAll block that will run at the start of the block that contains it, or at the start of the file if not contained in any block. Now that we split the tests into groups we might want to share some common code among those tests. And then, if needed, Context blocks are used inside of the Describe to group tests based on what aspect of the function you are testing. ![]() Typically the top-level block is a Describe that is named after the function that is being tested. In almost all cases Context can be used interchangeably with Describe. You can also nest Describes into each other to give your test suite more structure.Ī similar keyword to Describe is Context. You can have one or more Describes per file. This keyword allows you to group tests (represented by It blocks) into groups. We can quickly look at the rest of the Pester keywords that we used. When the test was passing before, but it is not anymore, you first blame the tested function. If the test is new, and the function existed for a while, you first blame the test. What you usually do is that you look at what changed more recently. This is a bad way to break the test.īeing able to distinguish between those two is important, when your test breaks keep in mind that either the function, or the tests might be broken.
0 Comments
Leave a Reply. |