首页 > 解决方案 > 需要使用 Groovy 在 SoapUI 中调用 PowerShell 文件

问题描述

我需要使用 Groovy 脚本在 SoapUI 中调用 PowerShell 文件。

这是我尝试过的(不起作用):

def testprojectDir = context.expand('${projectDir}')

def fileName = "test.ps" 

def file1 = new File(testprojectDir + '/Testdata///' + fileName );

def powerShellCommand = file1

def shellCommand = "powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile  -Command \"${powerShellCommand}\""

def process = shellCommand.execute()

process.waitFor()

“test.ps”中的PowerShell代码如下:“Some text...” | Out-File C:\temp\filename1.txt -encoding ascii

有什么建议可以让 Groovy 与 PowerShell 一起工作吗?

标签: powershellgroovysoapui

解决方案


推荐阅读