我是 PowerShell、Pester和新的 VSO 构建系统的新手,我正在尝试让 Pester 为每次签入运行我的测试。我已经设置并配置了一个简单的 PowerShell 脚本以在每次签入时运行。
我首先简单地尝试了 Invoke-Pester 以查看 VSO 团队是否已经设想到这一点并设置了通用单元测试框架,但我得到了以下可预测的结果:
Invoke-Pester : The term 'Invoke-Pester' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\a\64df1c11\Operations Tools\powershell\runPowershellTests.ps1:1 char:1
+ Invoke-Pester
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-Pester:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我尝试使用 PSGet:
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
install-module Pester
Invoke-Pester
但这也不起作用:
New-Item : Access to the path 'PsGet' is denied.
At line:17 char:5
+ New-Item -Path ($Destination + "\PsGet\") -ItemType Directory -Force | Out-N ...
如何远程安装和执行 Pester 来运行我的单元测试?