简体   繁体   中英

How to execute shell script using soapUI

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

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM