Skip to content

TestCases and TestDrive #1645

@Glober777

Description

@Glober777

1. General summary of the issue

With TestCases being evaluated during the discovery phase, it is no longer possible to account for the TestDrive value be available when TestCases value is defined. For that same reason, a variable that's used for TestCases cannot be defined within the BeforeAll block.

2. Describe Your Environment

Pester version     : 5.0.2 C:\Users\seriavio\Documents\PowerShell\Modules\Pester\5.0.2\Pester.psd1
PowerShell version : 7.0.0
OS version         : Microsoft Windows NT 10.0.18363.0

3. Expected Behavior

In 4th version of the Pester module, this was working fine, but in 5th, I'll have update the test code by embedding the value of the TestDrive directly within test itself.

4.Current Behavior

All mentions of TestDrive within the TestCases are replaced with null.

5. Possible Solution

Update the code within the It block to dynamically update the provided TestCases instance value with the actual value of a TestDrive variable

6. Context

I discovered the issue when I was trying to move my tests to Pester 5. In this case, I'll be able to update my code, but I think that this should be added to the list of Breaking Changes maybe?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions