我有一个天蓝色的powershell脚本
Invoke-Pester -Script @{Path = 'C:\Turing\Test\Frida-launcher.ps1'; Parameters = @{frida_process_id = '1655944245'; frida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}} -OutputFile "frida-results.xml" -OutputFormat "NUnitXML"
在运行管道的机器上调用另一个powershell脚本
param($frida_process_id, $frida_user, $frida_psw)
"current location: $(Get-Location)"
"script root: $PSScriptRoot"
"retrieve available modules"
$modules = Get-Module -list
if ($modules.Name -notcontains 'pester') {
Install-Module -Name Pester -Force -SkipPublisherCheck
}
#$frida_process_id = $args[0]
#$frida_user = $args[1]
#$frida_psw = $args[2]
Describe "Suites - Prueba" {
It "Test Case Script - HEB - FRIDA - eCommerce - 706161449 _ Conexion Exitosa " {
Start-Process -FilePath "C:\Turing\App\TuringExpo.exe" "$frida_process_id $frida_user $frida_psw" -Wait
Set-Content -Path TestDrive:\log.txt -Value 'I am a file'
$actual = "Actual value"
$actual | Should -Be "Actual value" # Test will pass / Assert
$actual | Should -Not -Be "Some other value" # Test will pass / Assert Negative
# $actual | Should -Be "not actual value" # Test will fail
'C:\Turing\App\log.txt' | Should -Exist
Set-Content -Path TestDrive:\log.txt -Value 'Success'
'TestDrive:\log.txt' | Should -FileContentMatch 'Success' # Test will pass
}
}
问题是,到目前为止,我只需要运行一个测试用例,但是现在,我需要运行一个测试套件,但是我不知道如何发送每个测试用例的参数。
我试图这样做
Invoke-Pester -Script @{Path = 'C:\Turing\Test\Frida-launcher.ps1'; Parameters = @{frida_process_id = '807028544'; frida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}
@{frida_process_id = '1354584657'; frida_user = 'heber.solis@softtek.com'; frida_psw = 'password'}} -OutputFile "frida-results.xml" -OutputFormat "NUnitXML"
但是它抛出了这个错误
“ C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe” -NoLogo -NoProfile -NonInteractive -ExecutionPolicy不受限制-命令“。'C:\ agent_work_temp \ 67c2cb15-7277-43ea-a21e-c1a5aaab3309.ps1'”在 C:\ agent_work_temp \ 67c2cb15-7277-43ea-a21e-c1a5aaab3309.ps1:3 字符:99 + ... ida_user ='heber.solis@softtek.com'; frida_psw ='password'}} -Outpu ... +〜键入哈希文字后,缺少'='运算符。在 C:\ agent_work_temp \ 67c2cb15-7277-43ea-a21e-c1a5aaab3309.ps1:3 字符:99 + ... ida_user ='heber.solis@softtek.com'; frida_psw ='password'}} -Outpu ... +〜散列文字不完整。 + CategoryInfo:ParserError:(:) [],ParseException + FullyQualifiedErrorId:MissingEqualsInHashLiteral
[错误] PowerShell退出,代码为“ 1”。整理:PowerShell脚本
感谢您的帮助