Is it possible to call a batch file in SOA test using Jython
Hi Team,
I tried to call a batch file(.bat), basically i am using the batch file to capture the logs. i have tried running a script in Jython
import os
os.system("C:\Logs\logs.bat")
the extension tool gives success but i dont see the batch file opening.
Can some one help on this issue
Thanks.
Comments
-
Hi kamit2733
did you try to use External Tool?
It might be easier.
What you should to see after opening logs.bat file?
According to python documentation:On Windows, the return value is that returned by the system shell after running command, given by the Windows environment variable COMSPEC: on command.com systems (Windows 95, 98 and ME) this is always 0; on cmd.exe systems (Windows NT, 2000 and XP) this is the exit status of the command run; on systems using a non-native shell, consult your shell documentation.
Do you have access to os modules?
On my side following script works as expected:Ireneusz Szmigiel
1 -
kamit2733
you don't need subprocess module. In my script I have additional part which use subprocess.
0 -
Hi Ireneusz
Is it possible to capture the log.bat output in SOA Write File?
Thanks
0 -
kamit2733
I don't think is possible with your script. See my first comment and part from python documentation.
You should rewrite your script to use subprocess instead of os.system.
Or (even better), do not use bat file, just write script in Extension tool which can do the same.
Ireneusz Szmigiel0 -
Hello There,
I tried all the above mentioned options, however, soatest does not write out anything and keep running forever.. No error at all. What went wrong in my setting?Basic setting - helloworld.bat file
soatest version 9.10 or 2022v1Any suggestions would be highly appreciated.
0