8000 v5: Parametrized scripts are not implemented · Issue #1485 · pester/Pester · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
v5: Parametrized scripts are not implemented #1485
@nohwnd

Description

@nohwnd

The syntax for parametrizing scripts is not implemented.

originally posted by @JustinGrote on twitter

For Pester 5, how am I supposed to run pester tests with param blocks? I don't see any docs on it, in 4 there was the rather obtuse hashtable syntax. Is this not supported in 5 and should I switch to environment variables or something?

I found https://github.com/pester/Pester/blob/v5.0/README.md#advanced-interface

But no answers here. Seems to me that $config.run.Path needs to support a hashtable in addition to string:

path = @{
  path = 'path/to/my/test.ps1'
  parameters = @{
    mycustomparam = $true
    verbose = $true
  }
}

TODO:

  • Single path with single set of data
@{
    Path = "C:\temp\abc.Tests.ps1",
    Data = @{
        Name = "Jakub"
        Age = 31
    }
}
  • Multiple instances of the same path each with it's own data
@(
    @{
        Path = "C:\temp\abc.Tests.ps1",
        Data = @{
            Name = "Jakub"
            Age = 31
        }
    }
    @{
        Path = "C:\temp\abc.Tests.ps1",
        Data = @{
            Name = "Thomas"
            Age = 29
        }
    }
)
  • Single path with multiple sets of data (alternative to the above)
@{
    Path = "C:\temp\abc.Tests.ps1",
    Data = @(
        @{
            Name = "Jakub"
            Age = 31
        }
        @{ 
            Name = "Thomas"
            Age = 29
        }
    )
}
  • Multiple different paths each with it's own data
@(
    @{
        Path = "C:\temp\abc.Tests.ps1",
        Data = @{
            Name = "Jakub"
            Age = 31
        }
    }
    @{
        Path = "C:\temp\gef.Tests.ps1",
        Data = @{
            Color = "Blue"
        }
    }
)
  • Providing path with wildcard should expand the path to multiple containers

  • Providing Path that resolves to the same path as Container should skip the paths that already have data, because those files are parametrized and would likely fail

  • API review

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0