繁体   English   中英

远程安装和调用Pester

[英]Install and invoke Pester remotely

我是PowerShell,Pester 新的VSO构建系统的新手,并且试图让Pester在每次签入时运行测试。我已经设置并配置了一个简单的PowerShell脚本,可以在每次签入时运行。

已配置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来运行单元测试?

尝试使用PsGet:

(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
Install-Module Pester -Global

或使用Chocolatey

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco install pester

VSO市场中有一项任务可以让您运行Pester单元测试。 该任务可以在市场上找到。 您可以在以下位置查看源代码: git Vsts-Build-Pester

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM