Hi. i'm trying like crazy to run an .exe or a batch file via groovy in soapui.
I've tried:
def command = "cmd.exe /c h:\\BatchFile\\DownloadLogFile.bat"
proc = command.execute()
proc.waitForOrKill(5000)
def torun = "C:\\Windows\\System32\\cmd.exe"
proc = torun.execute()
proc.waitForOrKill(5000)
def torun = "h:\\BatchFile\\DownloadLogFile.bat"
proc = torun.execute()
proc.waitForOrKill(5000)
No errors generate from groovy in soapui but no results either
Thanks
Solved! Go to Solution.
Please refer to this KB:
How to execute process in Groovy and get output of process?
Nothing. The best i get is Script-result:java.lang.ProcessImpl@3ca1xxx. 😞
bummer. anybody having any success executing any .exe?
When Creating exe, make it to return error codes (integer can be returned from exe)
and while the below command is executed,
proc = command.execute()
error codes will be stored in "proc" variable.
use this variable to check the result.
Hope this helps.
I am trying to execute .bat file in groovy using below 2 types; both are failing
Found solution which is working for me, executes .bat file by opening cmd prompt
Need to add script in bat file and SoapUI script
- Set bat file path in bat file; this is needed while executing bat file since in SoapUI during execution it is taking path of SoupUI so file is not available in that path, add below lines in your bat file
- Set again path in SoapUI script
That works in most cases! Thanks!
How would you deal with spaces in the folder such as(example only):
Process proc=Runtime.getRuntime().exec("cmd /c start C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
proc.waitFor()
Or even:
Process proc=Runtime.getRuntime().exec( 'C:\\DownloadLogFile.bat' );
proc.waitFor()
which doesn't work either
User | Count |
---|---|
6 | |
5 | |
4 | |
2 | |
1 |
Subject | Author | Latest Post |
---|---|---|