Logo QF-Test

Finding valuable answers
in the Mailing List Archive.


Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2012

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] shell command execution in QF-Test -- how to?

  • Subject: Re: [QF-Test] shell command execution in QF-Test -- how to?
  • From: "Gauthier, Denis" <Denis.Gauthier@?.au>
  • Date: Wed, 15 Feb 2012 14:18:38 +1100

Hi Zsolt,

You can use these lines in a Jython Server Script:

import os

fullCommand = 'your command'
f = os.popen(fullCommand)
output = f.read()

Just stick the command you want to execute and you will get the output as a string inside the output variable.
Not too sure if stderr is grabbed as well though.



On 14/02/2012 8:18 PM, Berg, Klaus-Peter wrote:
Hello Hajnal,
I guess since Java 5 you can use the java.lang.ProcessBuilder class.
ProcessBuilder.start() returns a Process object, where you can call: getOutputStream() , getErrorStream().
Unfortenately I have no Jython script example like the one you are using now:

import os 

os.system(’systeminfo > temp.txt’)

I'm using Groovy instead of Jython with respect to QF-Test...


Best regards

Klaus Peter

------------------------------------------------------------------------- DISCLAIMER: This e-mail transmission and any documents, files and previous e-mail messages attached to it are private and confidential. They may contain proprietary or copyright material or information that is subject to legal professional privilege. They are for the use of the intended recipient only. Any unauthorised viewing, use, disclosure, copying, alteration, storage or distribution of, or reliance on, this message is strictly prohibited. No part may be reproduced, adapted or transmitted without the written permission of the owner. If you have received this transmission in error, or are not an authorised recipient, please immediately notify the sender by return email, delete this message and all copies from your e-mail system, and destroy any printed copies. Receipt by anyone other than the intended recipient should not be deemed a waiver of any privilege or protection. Thales Australia does not warrant or represent that this e-mail or any documents, files and previous e-mail messages attached are error or virus free. -------------------------------------------------------------------------

Videos Downloads Documentation Buy Free Trial