问题
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