腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
Can
Pester
Mock
[
Type
]::
new
()
powershell
、
pester
我有一个包含以下代码的脚本: $var1 = [TESTType]::
new
($Var) 我想运行一个纠缠测试,模拟TESTType::
new
($Var)。这是可能的吗?
浏览 22
提问于2020-09-09
得票数 2
2
回答
Mock
New
- Microsoft.Azure.Commands.Dns.DnsRecordBase[]类型的AzureRmDnsRecordConfig返回值
powershell
、
azure
、
pester
我试着使用
Pester
的新的CMDLET
New
-MockObject,但是我得到了这个错误: MemberAccessException: Cannotat
New
-MockObject, C:\Program Files\WindowsPowerShell\Modules\
Pester
\4.0.6\Functions\
New
-MockObject.ps1
Pester
\4.0.6\Functions\
Mock
.ps
浏览 0
提问于2017-08-24
得票数 1
1
回答
无法模拟启动进程powershell {}命令?
powershell
、
unit-testing
、
pester
我是这样写这个模拟的:
Mock
start-process {} 在我的测试文件中。
浏览 9
提问于2020-01-15
得票数 0
2
回答
如何在
Pester
测试中模拟读-主机?
powershell
、
pester
我想做这样的事情(不起作用): Context "When something" {
Mock
Read-Host {return "c:
浏览 8
提问于2016-12-22
得票数 3
回答已采纳
1
回答
Pester
InvokeVerifiable验证特定的模拟调用
powershell
、
pester
我有点挣扎于v5
Pester
使用模拟的方式。有人能给我举个例子吗?我如何验证通过Should -InvokeVerifiable调用了一个特定的模拟?以及如何检查特定的模拟是否被称为n次。我还检查了
Pester
docu ,但没有找到答案。我只找到了一个调用所有模拟的例子。示例: $localPsSession =
New
-PSSession -ComputerName "localhost"
浏览 2
提问于2020-12-02
得票数 1
回答已采纳
1
回答
模拟写入-使用invoke-
pester
时,冗余不起作用
powershell
、
pester
以下脚本在使用点运行时有效,但在使用invoke-
pester
(运行
Pester
版本4.6.0)调用时无法运行。是我做错了什么,还是invoke-
pester
有问题?/Test.psm1" Context 'test' {
mock
Write-Verbose{ write-host $Messag
浏览 17
提问于2019-03-16
得票数 2
1
回答
从闭包创建的
Pester
Mock
中的空列表
powershell
、
pester
cmdLog | Write-Host }.GetNewClosure()
Mock
ExecuteSqlCommand (CreateExecutedCommandsLoggerScriptBlock>, <No file>: line 7 at <ScriptBlock>, C:\U
浏览 1
提问于2016-01-27
得票数 0
回答已采纳
1
回答
VSTS未在结果中显示通过NUnit测试
unit-testing
、
powershell
、
nunit
、
azure-pipelines
= tokens[i].
Type
; {Exporting function 'Invoke-
Mock
'.Importing function 'Invo
浏览 0
提问于2017-11-22
得票数 0
1
回答
我可以模拟DllImport函数吗?
powershell
、
pester
假设我有一个添加自定义类型的powershell脚本,如: //...[Native]::GetLogs { return 5 } -Verifiable [13352] at Validate-Command, C
浏览 1
提问于2018-07-19
得票数 0
回答已采纳
1
回答
我可以绕过Powershell中的权限吗?
powershell
、
scripting
、
permissions
、
permission-denied
、
pester
我正在使用
pester
在Powershell中测试一个脚本,但是我看不出这个脚本是否有效,因为我一直被拒绝访问某些文件。不管怎么说,这样我才能看到我的脚本是否有效呢?
浏览 2
提问于2018-09-19
得票数 1
回答已采纳
1
回答
如何使用纠缠程序进行模拟
powershell
、
pester
如何在
Pester
中模拟?It 'Test get latest version' { return $-CommandName 'Get-ChildItem' â€MockWith" value of
type
"System.String" to
type
"System.Management.Au
浏览 23
提问于2021-11-23
得票数 0
回答已采纳
2
回答
如何在
Pester
中模拟Azure PowerShell Cmdlet?
azure
、
powershell
、
unit-testing
、
mocking
、
pester
WSManStackVersion 3.0SerializationVersion 1.1.0.1Describe "CleanUp-Resources" -Tags "Disabled", "Unit"{
Mock
Set-AzContext {} Con
浏览 0
提问于2019-07-18
得票数 0
回答已采纳
3
回答
如何使用不同的参数和不同的结果模拟被调用两次的命令
powershell
、
pester
我有一个PowerShell函数,我想用
Pester
测试一下: function Install-RequiredModule ( [string如何使用
Pester
测试此功能? 我在PowerShell论坛here上读到,我应该能够用不同的参数过滤器模拟同一命令两次。securePassword = "mypassword" | $psCredential =
浏览 38
提问于2019-06-25
得票数 1
回答已采纳
1
回答
纠缠断言-MockCalled计数错误
powershell
、
unit-testing
、
pester
用
Pester
和Powershell编写一些测试Import-Module Module
Mock
Add-ADGroupMember {throw [AddPatchGroups.Tests.ps1: line 25 at D
浏览 0
提问于2018-07-24
得票数 1
回答已采纳
1
回答
如何用
Pester
来模拟$host.ui.PromptForChoice?
powershell
、
pester
<# wrap the menu so we
can
mock
calls to itfunction internalMenuWrapper {prompt, $opts) { foreach ($opt in $opts) { Context "when called"
浏览 0
提问于2019-08-28
得票数 2
回答已采纳
3
回答
如何用
Pester
模拟对exe文件的调用?
unit-testing
、
powershell
、
mocking
、
pester
我试试看: Context "Create-Object" {
Mock
find Command & "C:\temp\my.exe" at Validate-Command, C:\Program Files\WindowsPowerShell\Modules\
Pester
\Functions\
Mock
.ps1
浏览 4
提问于2016-06-20
得票数 8
回答已采纳
1
回答
Pester
不工作的模拟函数
powershell
、
mocking
、
pester
我的测试中有以下代码:
Mock
Get-Disk { }
Mock
Get-Partition { param([PSCustomObject] $InputObject
浏览 14
提问于2022-04-21
得票数 1
回答已采纳
1
回答
如何在类模块(.psm1)中测试方法?
powershell
、
pester
我想为我创建的每个类模块(.psm1)创建
Pester
测试,包括它们的方法。class MyClass [string]GetID() [string]$id =
New
-Guid }如何导入MyClass,以及如何在
Pester
中模拟
New
?
浏览 11
提问于2022-04-07
得票数 0
回答已采纳
1
回答
如何在powershell提供程序纠缠测试失败时失效封隔器管道?
azure-devops
、
packer
我的进展情况:将
Pester
脚本复制到远程计算机从
Pester
远程运行下载测试结果 "
type
": "file",
浏览 0
提问于2020-03-11
得票数 3
1
回答
如何使用函数中的参数设置
Pester
模拟
powershell
、
unit-testing
、
pester
我希望通过将
mock
的声明移动到助手函数中来减少测试中的重复,例如SetupValidStateForUser 我可以毫无问题地从函数中声明
Mock
,但是一旦我引入了一个使用-ParameterFilter的
Mock
,该参数使用了helper函数中的参数,那么在解析
Mock
时,传递给helper函数的参数看起来不在作用域中。我如何调整
mock
声明,使我的参数将被正确解决? 我在PowerShell 7上使用的是佩斯特v5。下面是一个测试,展示了失败的场景: Context "Setting up
浏览 18
提问于2021-07-20
得票数 0
点击加载更多
相关
资讯
Mock | 拦截ajax的两种实现方式
Golang 单元测试:有哪些误区和实践?
Machine Learning in Action(2)——a simple KNN algorithm
Apache Kafka 2.0.0 正式发布,分布式消息发布订阅系统
Playwright自动化测试 - 玩转请求拦截与模拟
热门
标签
更多标签
云服务器
对象存储
ICP备案
云点播
智聆口语评测
活动推荐
运营活动
广告
关闭
领券