How to execute shell script using soapUI

匆匆过客 提交于 2019-12-11 07:13:38

问题


I have one shell script like sample.sh . I want to execute this script using soapUI. How to execute it using soap UI??


回答1:


You can use Groovy Step to do this. Something like:

p = Runtime.getRuntime().exec("sample.sh")
p.waitFor()



回答2:


if you want to get results as a string:

Windows:

def result = 'cmd /c sample.bat'.execute().text

Shell:

def result = 'sh -c sample.sh'.execute().text

Please note, the "cmd /c" or "sh -c" part is needed usually to execute a file. If you want to run simple internal commands such as "dir" or "ls", then it won't be necessary.



来源:https://stackoverflow.com/questions/29151421/how-to-execute-shell-script-using-soapui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!