Mailingliste - Einträge 2012
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [QF-Test] can I use regular experession directly in a If condition
yes, that's enough. Regards, Martin--On Freitag, Februar 17, 2012 11:04:45 -0500 Brian Cohen <Brian.Cohen@?.com> wrote: Sall I really need is is a Jython Server Script node that says: import re ? -Brian -----Original Message----- From: Martin Moser [mailto:martin.moser@?.de] Sent: Friday, February 17, 2012 10:53 AM To: qftest-list@?.de Cc: Brian Cohen Subject: Re: [QF-Test] can I use regular experession directly in a If condition Hi Brian, I've found an simpler way for that. It's enough just to import the module in a Jython Server script. The global definition is not required for modules like re, but can be used for Jython variables of course. Best Regards, Martin --On Freitag, Februar 17, 2012 06:02:37 -0500 Brian Cohen <Brian.Cohen@?.com> wrote:Thanks Martin. So steps below applies to any Jython object.method you want to access outside the Jython Server Script: - import required module if necessary - declare a global variable - set the variable ( in this case, the Jython object) - then use Jython methods on that global variable ( which actually is a Jython object) in Qftest nodes by enclosing in $[] Am I understanding this correctly? -Brian On Feb 17, 2012, at 2:42 AM, "Martin Moser" <martin.moser@?.de> wrote:Hi Brian, you can use re.match in If-nodes of QF-Test if you do following: 1.) all a Jython-Server-Script, setting the re-module globally. Code: import re global re re=re 2.) After calling this script once you can use the re syntax in a If-node like this: $[re.match(".*","a") == None] The first script could be called once in your Setup node and then you are free to use it. It's now up to you, whether you think this is a good way to go for or whether you prefer inserting a pure script node. Best Regards, Martin --On Mittwoch, Februar 15, 2012 16:37:21 -0500 Brian Cohen <Brian.Cohen@?.com> wrote:Wondering if I can do this, or do I have to insert a Jython Server/SUT node using the "re" module. -Brian-- Martin Moser martin.moser@?.de Quality First Software GmbH http://www.qfs.de Tulpenstr. 41 Tel: +49 8171 38648-14 DE-82538 Geretsried Fax: +49 8171 38648-16 GF: Gregor Schmid, Karlheinz Kellerer HRB München 14083 -- Martin Moser martin.moser@?.de Quality First Software GmbH http://www.qfs.de Tulpenstr. 41 Tel: +49 8171 38648-14 DE-82538 Geretsried Fax: +49 8171 38648-16 GF: Gregor Schmid, Karlheinz Kellerer HRB München 14083
|